Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to hide post from post list #10

Open
RMCampos opened this issue Aug 10, 2020 · 5 comments
Open

Option to hide post from post list #10

RMCampos opened this issue Aug 10, 2020 · 5 comments

Comments

@RMCampos
Copy link
Contributor

Hello! How can I hide a post from showing on the blog roll and post list? Is that possible?

Reason: I want to keep for each post an equivalent post at another language. For example, I write in portuguese (slug: my-post-name) and I want to have an English version of it (slug: my-post-name-en), and this version (English) I don't want to display in post list. A link [See this page in English] at the bottom of the portuguese version it's enough.

Thanks!

@Forever-Young
Copy link
Contributor

Long ago I forked to add multilang support. https://bitbucket.org/ForeverYoung/blohg/ , maybe that would help

@RMCampos
Copy link
Contributor Author

Seems very interesting to me @Forever-Young. How about a pull request? @rafaelmartins what do you think?

@Forever-Young
Copy link
Contributor

Forever-Young commented Aug 10, 2020 via email

@rafaelmartins
Copy link
Owner

the post metadata is composed by arbitrary variables. you could simply implement a jinja2 template filter to filter the posts list in templates, filtering by some variable you define, so you would have something like:

{% for post in posts|filter_by_metadata(lang='pt-br') %}
...
{% endfor %}

@RMCampos
Copy link
Contributor Author

I couldn't make it like you said @rafaelmartins probably the best way. However adding a property lang in Post model do the trick. Like in https://github.com/RMCampos/blohg/commit/3e9785dc3f970215b6804b0dde5fe03e87566417

Then I just added this in template: {%- if post.lang == 'pt-br' or full_content -%}. The second condition it's needed to show any post in full content view. And adding post lang directive off course.

Thank's anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants