Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll Github pages how to hide a post

Tags:

I am using jekyll with Github pages for my website. I am trying to make some posts not visible in the home but they can be linked from another post. In the frontmatter I tryed to add a field visible like this:

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

And then in the index.html file I did a 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 post won't be visible in the home. Unfortanely this is not working, do you have any hints? Thanks

like image 448
kilian Avatar asked May 29 '14 13:05

kilian


1 Answers

This works for me:

--- layout: post title: About Lumen published: false ---  See [About]({{ site.baseurl }}/about) 
like image 197
Hendy Irawan Avatar answered Mar 20 '23 08:03

Hendy Irawan