Issue #6 List of pages per user

This commit is contained in:
Alexis Hassler
2019-05-18 11:21:16 +02:00
parent 45bc42f572
commit e285abc65b
21 changed files with 109 additions and 116 deletions

View File

@@ -3,12 +3,11 @@ layout: default
title: All pages
menu: ['global']
---
{%- include /functions/wiki-pages.html -%}
<ul class="columns">
{%- for page in wiki_pages -%}
{%- for page in site.data.wiki_pages -%}
<li>
<a href="{{ page.url }}.html">{{ page.title }}</a>&nbsp; [{{ page.bytes }} bytes]
{%- if page.author -%}&nbsp;(by <a href="/{{ site.data.i18n[site.lang].prefix.user }}{{ page.author }}.html">{{ page.author }}</a>) {%- endif -%}
{%- if page.author_full -%}&nbsp;(by <a href="{{ page.author_full.url }}.html">{{ page.author_full.name }}</a>) {%- endif -%}
</li>
{%- endfor -%}
</ul>

View File

@@ -3,11 +3,10 @@ layout: default
title: Tags
menu: ['global']
---
{%- include /functions/wiki-tags.html -%}
<ul>
{%- for tag in tags -%}
{%- for tag in site.data.wiki_tags -%}
{%- assign counter = 0 -%}
{%- for other_page in wiki_pages %}
{%- for other_page in site.data.wiki_pages %}
{%- if other_page.tags contains tag -%}
{%- assign counter = counter | plus: 1 -%}
{%- endif -%}

View File

@@ -3,14 +3,13 @@ layout: default
title: Redirects
menu: ['global']
---
{%- include /functions/wiki-pages.html -%}
{%- assign redirect_pages = site.special | where_exp: 'page', 'page.redirect' -%}
<ul>
{%- for source_page in redirect_pages -%}
<li>
{%- assign redirect = source_page.redirect | liquify | prepend: '/' -%}
{%- for other_page in wiki_pages -%}
{%- for other_page in site.data.wiki_pages -%}
{%- if other_page.id == redirect -%}
{%- assign redirect_page = other_page -%}
{%- endif -%}

View File

@@ -3,15 +3,10 @@ layout: default
title: Users
menu: ['global']
---
{%- include /functions/wiki-tags.html -%}
<ul>
{%- for user in site.data.users -%}
{%- assign counter = 0 -%}
{%- for other_page in wiki_pages %}
{%- if other_page.author == user[0] -%}
{%- assign counter = counter | plus: 1 -%}
{%- endif -%}
{%- for author in site.data.authors -%}
<li>
<a href="{{ author.url }}.html">{{ author.name }}</a> (<a href="{{ author.contributions_url }}.html">{{author.contributions_count}} pages</a>)
</li>
{%- endfor -%}
<li><a href="/{{ site.data.i18n[site.lang].prefix.user }}{{ user[0] }}.html">{{ user[1].name }}</a> ({{counter}} pages)</li>
{%- endfor -%}
</ul>

View File

@@ -3,8 +3,7 @@ layout: default
title: Long pages
menu: ['global']
---
{%- include /functions/wiki-pages.html -%}
{%- assign long_pages = wiki_pages | sort: 'bytes' | reverse -%}
{%- assign long_pages = site.data.wiki_pages | sort: 'bytes' | reverse -%}
<ol>
{%- for page in long_pages limit:50 -%}
<li>

View File

@@ -3,8 +3,7 @@ layout: default
title: Recent changes
menu: ['global']
---
{%- include /functions/wiki-pages.html -%}
{%- assign recent_changes = wiki_pages | where_exp: 'page', 'page.modified' | sort: 'modified' | reverse -%}
{%- assign recent_changes = site.data.wiki_pages | where_exp: 'page', 'page.modified' | sort: 'modified' | reverse -%}
<ul>
{%- for page in recent_changes limit:20 -%}
<li>

View File

@@ -3,8 +3,7 @@ layout: default
title: Short pages
menu: ['global']
---
{%- include /functions/wiki-pages.html -%}
{%- assign long_pages = wiki_pages | sort: 'bytes' -%}
{%- assign long_pages = site.data.wiki_pages | sort: 'bytes' -%}
<ol>
{%- for page in long_pages limit:50 -%}
<li>

View File

@@ -7,8 +7,7 @@ layout: null
<title>{{ site.title }}</title>
<description>{{ site.description }}</description>
<link>{{ site.url }}</link>
{% include /functions/wiki-pages.html %}
{% for post in wiki_pages reversed%}
{% for post in site.data.wiki_pages reversed%}
{% unless post.draft %}
<item>
<title>{{ post.title | xml_escape }}</title>

View File

@@ -2,46 +2,11 @@
layout: default
title: Tags
---
{% assign var = 10 %}
{% comment %}
=======================
The following part extracts all the tags from your posts and sort tags, so that you do not need to manually collect your tags to a place.
=======================
{% endcomment %}
{% assign rawtags = "" %}
{% include /functions/wiki-pages.html %}
{% for wiki_page in wiki_pages %}
{% assign ttags = wiki_page.tags | join:'|' | append:'|' %}
{% assign rawtags = rawtags | append:ttags %}
{% endfor %}
{% assign rawtags = rawtags | split:'|' | sort %}
{% comment %}
=======================
The following part removes dulpicated tags and invalid tags like blank tag.
=======================
{% endcomment %}
{% assign tags = "" %}
{% for tag in rawtags %}
{% if tag != "" %}
{% if tags == "" %}
{% assign tags = tag | split:'|' %}
{% endif %}
{% unless tags contains tag %}
{% assign tags = tags | join:'|' | append:'|' | append:tag | split:'|' %}
{% endunless %}
{% endif %}
{% endfor %}
<ul>
{% for tag in tags %}
{% for tag in site.data.wiki_tags %}
<li id="n-tag-{{ tag }}"><a href="/{{ site.data.i18n[site.lang].prefix.tag }}{{ tag }}.html">{{ tag }}</a></li>
<ul>
{% for other_page in wiki_pages %}
{% for other_page in site.data.wiki_pages %}
{% if other_page.tags contains tag %}
<li><a href="{{ other_page.url }}">{{ other_page.title }}</a></li>
{% endif %}