From 9dbe03f4fe038236d5b643872fa5ab481a792980 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 6 Apr 2023 11:28:25 -0300 Subject: v2: Add support for src/redirect.mappings via symlinks --- v2/dynamic.mk | 11 +++++++++-- v2/src/redirect.mappings | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 v2/src/redirect.mappings (limited to 'v2') diff --git a/v2/dynamic.mk b/v2/dynamic.mk index b8fbba3..06d9bbf 100644 --- a/v2/dynamic.mk +++ b/v2/dynamic.mk @@ -44,13 +44,19 @@ clean: src/content/*/*/*.sortdata src/content/**/feeds/ \ -public: $(derived-assets) copy-content.sentinel copy-code-snippets.sentinel +public: $(derived-assets) symlink-mappings.sentinel copy-content.sentinel copy-code-snippets.sentinel content = \ $(all-generated.html) \ $(all-generated.xml) \ $(static-content) \ +symlink-mappings.sentinel: src/redirect.mappings content-mkdir.sentinel + < src/redirect.mappings \ + awk '{ printf "ln -rfs public/%s public/%s\n", $$2, $$1 }' | \ + sh + touch $@ + copy-content.sentinel: $(content) content-mkdir.sentinel echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \ xargs -P`nproc` -I% ln -f src/content/% public/% @@ -62,8 +68,9 @@ copy-code-snippets.sentinel: $(all-generated.snippets) content-mkdir.sentinel xargs -P`nproc` -I% ln -f src/content/% public/% touch $@ -content-mkdir.sentinel: $(content) $(all-generated.snippets) +content-mkdir.sentinel: $(content) $(all-generated.snippets) src/redirect.mappings echo $? | tr ' ' '\n' | grep '^src/content/' | sed 's|^src/content/||' | \ + printf '%s\n%s\n' "`cat -`" "`awk '{print $$2}' src/redirect.mappings`" | \ xargs dirname | \ sort | \ uniq | \ diff --git a/v2/src/redirect.mappings b/v2/src/redirect.mappings new file mode 100644 index 0000000..6945e89 --- /dev/null +++ b/v2/src/redirect.mappings @@ -0,0 +1 @@ +index.html en/index.html -- cgit v1.2.3