Issue #7 List of redirections

This commit is contained in:
Alexis Hassler 2019-05-17 13:45:29 +02:00
parent a9c6585252
commit e9ee1f40d4
7 changed files with 39 additions and 10 deletions

View File

@ -29,3 +29,5 @@ global_pages:
text: Short pages
- url: /Special:ListUsers
text: All the users
- url: /Special:ListRedirects
text: Redirects

View File

@ -29,3 +29,5 @@ global_pages:
text: Pages courtes
- url: /Special:ListUsers
text: Tous les utilisateurs
- url: /Special:ListRedirects
text: Redirections

View File

@ -0,0 +1,21 @@
---
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 -%}
{%- if other_page.id == redirect -%}
{%- assign redirect_page = other_page -%}
{%- endif -%}
{%- endfor -%}
<a href="{{ source_page.url }}.html">{{ source_page.id }}</a><a href="{{ redirect_page.url }}.html">{{ redirect_page.title }}</a>
</li>
{%- endfor -%}
</ul>

View File

@ -1,7 +1,14 @@
{%- include /functions/wiki-pages.html -%}
{%- assign redirect = page.redirect | liquify -%}
{%- if include.page -%}
{%- assign source_page = include.source_page -%}
{%- else -%}
{%- assign source_page = page -%}
{%- endif -%}
{%- assign redirect = source_page.redirect | liquify -%}
{%- for other_page in wiki_pages -%}
{%- if other_page.slug == redirect -%}
{%- if other_page.id == redirect -%}
{%- assign redirect_page = other_page -%}
{%- endif -%}
{%- endfor -%}

View File

@ -8,7 +8,7 @@
<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 -%}
{%- if other_page.tags contains tag and other_page.slug != page.slug -%}
{%- if other_page.tags contains tag and other_page.id != page.id -%}
<li><a href="{{ other_page.url }}.html">{{ other_page.title }}</a></li>
{%- endif -%}
{%- endfor -%}

View File

@ -10,7 +10,7 @@ menu: ['global']
{% include /functions/wiki-pages.html %}
{% for tag in page.tags %}
{% for other_page in wiki_pages %}
{% if other_page.tags contains tag and other_page.slug != page.slug %}
{% if other_page.tags contains tag and other_page.id != page.id %}
<li><a href="{{ other_page.url }}">{{ other_page.title }}</a></li>
{% endif %}
{% endfor %}

View File

@ -118,7 +118,7 @@ The frontmatter may contain the following attributes:
## Redirect page
A redirect page should be place in a _wiki_ collection.
A redirect page should be place in the _special_ collection.
It should have a frontmatter with a **layout** and a **redirect**, and no content
```yaml
@ -207,12 +207,9 @@ If the site is deployed on a Apache HTTP server, some old mediawiki URLs are rew
## Github pages
The wiki may be deployed on Github pages with the following contraints:
The wiki cannot be deloyed simply on Github pages because of unsupported filters and custom plugins.
* Only HTML or Markdown, no Asciidoc
* No generated toc
If you want to have this features on Github pages, you should push the generated site.
If you want to deploy it on Github pages, you should push the generated site.
Any CI tool can help.
## Gitlab pages / CI