1
votes

I'm using the Jekyll --unpublished flag to display documentation while I'm working on a Jekyll powered site for things like a style guide, available Front Matter variables, etc. All files in /docs/ use the YAML Front Matter variable published: false.

What I'd like to do is add a menu item to the navigation during development only. This makes it so our developers don't have to type in a URL manually to access the docs.

Is there any way to access the flags that Jekyll is running under with liquid tags? If not, do you have any suggestions for how to display a menu item only when running under the --unpublished flag?

1

1 Answers

1
votes

A menu for published pages :

{% for page in site.pages %}
  {% if page.published == null or page.published == true %}
  <a href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>
  {% endif %}
{% endfor %}

And one for unpublished pages :

{% for page in site.pages %}
  {% if page.published == false %}
  <a href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>
  {% endif %}
{% endfor %}