[ACCEPTED]-Jekyll Github pages how to hide a post-github-pages

Accepted answer
Score: 43

This works for me:

---
layout: post
title: About Lumen
published: false
---

See [About]({{ site.baseurl }}/about)

0

Score: 12

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

Score: 6

Try to change your front-matter from visible:1 to 11 visible: 1.

I just tried to reproduce your example 10 on my machine, and I found that Jekyll seems 9 to picky about the blanks in the front-matter.

With 8 visible: 1, your example works for me.

With visible:1, Jekyll 7 outputs the following error message while 6 building the site:

YAML Exception reading 5 C:/foo/bar.md: (): could not find expected 4 ':' while scanning a simple key at line 3 5 column 1

...but it still finishes building 2 and the generated site works, except that 1 the post is not visible.

Score: 0

You need to modify the _layout/home.html file (In your case, it 2 might be the index.html file).

Try to use an if-endif statement,like 1 this:

{%- for post in site.posts -%}
  {% if post.hide == null or post.hide == false %}
    <li>
    {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
    <span class="post-meta">{{ post.date | date: date_format }}</span>
    <h3>
     <a class="post-link" href="{{ post.url | relative_url }}">
      {{ post.title | escape }}
     </a>
     </h3>          
    </li>
  
  {% endif %}
{%- endfor -%}

Then, hiding a post by hide: true. For example:

published: true
title: Some title
layout: post
hide: true

More Related questions