Generate index pages for tags and filters

This commit is contained in:
Adam Hollett
2016-06-14 11:04:31 -04:00
parent 8590bb5727
commit c2ead29ff9
7 changed files with 45 additions and 15 deletions

View File

@@ -16,9 +16,21 @@ exclude:
- node_modules
keep_files: ["css"]
# Plugins
gems:
- jekyll-redirect-from
# Front matter defaults
defaults:
- scope:
path: "" # an empty string here means all files in the project
values:
layout: default
- scope:
path: "filters"
values:
type: filter
- scope:
path: "tags"
values:
type: tag

View File

@@ -9,7 +9,7 @@
<ul class="section__links">
{% for item in site.pages %}{% if item.url contains section/ %}{% unless item.path contains "index" %}
<li><a href="{{ item.url | prepend: site.baseurl }}" class="section__link{% if item.url contains page.url and page.url != "/" %} section__link--is-active {% endif %}">{{ item.title }}</a></li>
<li><a href="{{ item.url | prepend: site.baseurl }}" class="section__link{% if item.url contains page.url and page.url != '/' and page.type != 'index' %} section__link--is-active{% endif %}">{{ item.title }}</a></li>
{% endunless %}{% endif %}{% endfor %}
</ul>
{% endfor %}

View File

@@ -1,4 +0,0 @@
---
layout: default
---

View File

@@ -1,5 +1,7 @@
---
title: Introduction
redirect_from:
- /basics/
---
Liquid code can be categorized into [**objects**](#objects), [**tags**](#tags), and [**filters**](#filters).

View File

@@ -1,10 +0,0 @@
---
layout: default
---
{% for doc in site.collections["filters"].docs %}
<h2 id="{{ doc.title | slugify }}">{{ doc.title }}</h2>
<div class="content">
{{ doc.content }}
</div>
{% endfor %}

14
filters/index.md Normal file
View File

@@ -0,0 +1,14 @@
---
title: Filters
type: index
---
**Filters** change the output of a Liquid object. You can append one or more filters to an object by separating the filter and its parameters by a pipe symbol `|`.
{% assign filter_pages = site.pages | where: 'type', 'filter' %}
{% for item in filter_pages %}
## [{{ item.title }}]({{ item.url }})
{{ item.content }}
{% endfor %}

16
tags/index.md Normal file
View File

@@ -0,0 +1,16 @@
---
title: Tags
type: index
---
**Tags** create the logic and control flow for templates. They are denoted by curly braces and percent signs: {% raw %}`{%` and `%}`{% endraw %}.
The markup used in tags does not produce any visible text. This means that you can assign variables and create conditions and loops without showing any of the Liquid logic on the page.
{% assign tag_pages = site.pages | where: 'type', 'tag' %}
{% for item in tag_pages %}
## [{{ item.title }}]({{ item.url }})
{{ item.content }}
{% endfor %}