Refactor tutorial listing logic in tutorials.md
This commit is contained in:
parent
8fc6f2e239
commit
978e822a8e
1 changed files with 9 additions and 8 deletions
|
|
@ -5,14 +5,15 @@ permalink: /tutorials/
|
|||
## Listing Tutorials
|
||||
|
||||
<ul>
|
||||
{% assign tutorials = site.pages | where_exp: "p", "p.path and p.path contains 'tutorials/'" %}
|
||||
{% for t in tutorials %}
|
||||
{% assign p = t.path | default: "" %}
|
||||
{% if p != "tutorials/index.md" and p != "tutorials/README.md" and p != "tutorials.md" %}
|
||||
<li>
|
||||
<a href="{{ t.url | relative_url }}">{{ t.title | default: p | replace: "tutorials/", "" }}</a>
|
||||
{% if t.date %} — <time datetime="{{ t.date | date_to_xmlschema }}">{{ t.date | date: "%Y-%m-%d" }}</time>{% endif %}
|
||||
</li>
|
||||
{% for p in site.pages %}
|
||||
{% assign path = p.path | default: "" %}
|
||||
{% if path != "" and path contains "tutorials/" %}
|
||||
{% unless path == "tutorials/index.md" or path == "tutorials/README.md" or path == "tutorials.md" %}
|
||||
<li>
|
||||
<a href="{{ p.url | relative_url }}">{{ p.title | default: path | replace: "tutorials/", "" }}</a>
|
||||
{% if p.date %} — <time datetime="{{ p.date | date_to_xmlschema }}">{{ p.date | date: "%Y-%m-%d" }}</time>{% endif %}
|
||||
</li>
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue