From 1897d0800d0a2c01f804bd37f407f15093075bcb Mon Sep 17 00:00:00 2001 From: Georg Krause <mail@georg-krause.net> Date: Mon, 14 Feb 2022 09:56:13 +0100 Subject: [PATCH] Make sure a default page is available in each language --- Makefile | 1 + pelicanconf.py | 7 ++++++- scripts/create_default_pages.sh | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 scripts/create_default_pages.sh diff --git a/Makefile b/Makefile index 0f96efe8..d721e515 100644 --- a/Makefile +++ b/Makefile @@ -46,6 +46,7 @@ help: html: "$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) + ./scripts/create_default_pages.sh clean: [ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)" diff --git a/pelicanconf.py b/pelicanconf.py index f7f17194..1b0945d1 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -1,6 +1,6 @@ AUTHOR = "Funkwhale Collective" SITENAME = "Funkwhale" -SITEURL = "http://localhost:8000" +SITEURL = "" PATH = "content" OUTPUT_PATH = "public/" @@ -41,6 +41,11 @@ THEME = "theme" PAGE_PATHS = [""] ARTICLE_PATHS = ["articles"] +PAGE_LANG_URL = "{slug}" +# We write all pages in their language and have a rule in the makefile to +# use the english one as fallback if there is no translated version for a +# language +PAGE_LANG_SAVE_AS = "{slug}/{lang}.html" PAGE_URL = "{slug}" PAGE_SAVE_AS = "{slug}/index.html" diff --git a/scripts/create_default_pages.sh b/scripts/create_default_pages.sh new file mode 100755 index 00000000..a2c519ff --- /dev/null +++ b/scripts/create_default_pages.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +for f in $(find public -name en.html); do + newfile=${f/en.html/index.html} + if [ ! -f "$newfile" ]; then + mv $f $newfile + fi +done -- GitLab