blohg icon indicating copy to clipboard operation
blohg copied to clipboard

Option to hide post from post list

Open RMCampos opened this issue 4 years ago • 5 comments

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!

RMCampos avatar Aug 10 '20 19:08 RMCampos

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

Forever-Young avatar Aug 10 '20 19:08 Forever-Young

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

RMCampos avatar Aug 10 '20 19:08 RMCampos

It's too behind.

On Mon, Aug 10, 2020, 10:39 PM Ricardo Campos [email protected] wrote:

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

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/rafaelmartins/blohg/issues/10#issuecomment-671549091, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF7GVCLKN5K44PHM3BNLB3SABEF3ANCNFSM4P2IL65Q .

Forever-Young avatar Aug 10 '20 19:08 Forever-Young

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 %}

rafaelmartins avatar Aug 11 '20 00:08 rafaelmartins

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.

RMCampos avatar Aug 11 '20 20:08 RMCampos