mirror of
https://github.com/kemko/liquid.git
synced 2026-01-01 15:55:40 +03:00
Generate index pages for tags and filters
This commit is contained in:
12
_config.yml
12
_config.yml
@@ -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
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
---
|
||||
title: Introduction
|
||||
redirect_from:
|
||||
- /basics/
|
||||
---
|
||||
|
||||
Liquid code can be categorized into [**objects**](#objects), [**tags**](#tags), and [**filters**](#filters).
|
||||
|
||||
@@ -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
14
filters/index.md
Normal 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
16
tags/index.md
Normal 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 %}
|
||||
Reference in New Issue
Block a user