NixOS / nixos-wiki-infra

This project contains the setup of https://wiki.nixos.org
https://wiki.nixos.org/
MIT License
48 stars 5 forks source link

Implementing section anchors & link template #119

Open mrmagic223325 opened 2 months ago

mrmagic223325 commented 2 months ago

The Gentoo Wiki uses a specially designed template to allow translating section names while still keeping HTML anchors with the source language name intact. This allows using links of the form https://wiki.nixos.org/wiki/Hydra#Installation in all languages regardless of the actual translation of Installation. The template is described here. Additionally the Gentoo Wiki also implements a special template for linking to translated pages here. This template allows redirecting users to the source language version of a page whenever a translated version does not exist.

Mic92 commented 2 months ago

Do you need any special permission to set up templates like this? Otherwise just copy over what you need.

Mic92 commented 2 months ago

Is there a way to automate this? As it looks a bit tedious to do this migration by hand.

Mic92 commented 2 months ago

@nicolas-goudry do you want to look into this?

nicolas-goudry commented 2 months ago

I'll take a look at it over the weekend if I have the chance to.

mrmagic223325 commented 2 months ago

Do you need any special permission to set up templates like this? Otherwise just copy over what you need.

I don't know how MediaWiki templates work internally or if there is anything else I'd have to do besides copying them, so I'd prefer not adding them myself.

Is there a way to automate this? As it looks a bit tedious to do this migration by hand.

Doing it by hand wouldn't be too much of a hassle given the wiki is not that big right now (Gentoo's migration is a lot bigger). Searching for all {{}} links inside a page and replacing them with the template is pretty simple. Adding anchors to every section is slightly more tedious but still pretty manageable. (Source: I've been part of the migration on the Gentoo Wiki and usually would translate pages and migrate the source pages whenever I encountered an old link or section in the process)