Jekyll github page how to hide message

I am using jekyll with Github pages for my site. I am trying to make some messages invisible in the house, but they may be associated with another message. In the front, I tried to add a field visible like this:

--- layout: post title: excerpt: visible:1 --- 

And then in the index.html file, I performed an if check:

 <div class="posts"> {% for post in paginator.posts %} {% if post.visible== 1 %} <div class="post"> <h1> <a href="{{ post.url }}"> {{ post.title }} </a> </h1> <span class="post-date">{{ post.date | date_to_string }}</span> <a class="subtitle" href="{{ post.url }}"> {{ post.excerpt }} </a> </a> </div> {% endif %} {% endfor %} </div> 

The idea is that when I set 0 in the visible field, the message will not be visible in the house. Unsuccessfully, this does not work, do you have any hints? Thanks

+7
html post github github-pages jekyll
source share
3 answers

Try changing your front material from visible:1 to visible: 1 .

I just tried to reproduce your example on my machine, and I found that Jekyll seems to understand the spaces in the front.

With visible: 1 your example works for me.

With visible:1 Jekyll displays the following error message when creating the site:

Reading YAML exceptions C: /foo/bar.md :(): could not find the expected ":" when scanning a simple key in row 5 of column 1

... but it still finishes creating, and the generated site is working, except that the message is not visible.

+4
source share

This works for me:

 --- layout: post title: About Lumen published: false --- See [About]({{ site.baseurl }}/about) 
+15
source share

If you want to exclude a post / page from pagination, you can add hidden: true to the original YAML field. https://github.com/jekyll/jekyll-paginate/issues/6

+1
source share

All Articles