aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-06-01 23:19:37 -0300
committerEuAndreh <eu@euandre.org>2022-06-01 23:19:37 -0300
commit742cbe8870d3258f07eedc933987c883591d0625 (patch)
tree94072dc5c81cf7ffc94196fb876845c4edccbf4e
parentdynamic.mk: Re-generate HTML files when genhtml.sh changes (diff)
downloadeuandre.org-742cbe8870d3258f07eedc933987c883591d0625.tar.gz
euandre.org-742cbe8870d3258f07eedc933987c883591d0625.tar.xz
src/development/genhtml.sh: Use relative URLs by default, with BASE_URL=/
-rw-r--r--src/development/config.env2
-rwxr-xr-xsrc/development/genhtml.sh24
2 files changed, 15 insertions, 11 deletions
diff --git a/src/development/config.env b/src/development/config.env
index 69466be..9da0910 100644
--- a/src/development/config.env
+++ b/src/development/config.env
@@ -1,5 +1,5 @@
#!/bin/sh
FQDN='euandre.org'
-BASE_URL='' # '/subfolder'
+BASE_URL='/' # '/subfolder'
lang=en
diff --git a/src/development/genhtml.sh b/src/development/genhtml.sh
index 34588ef..7baacf5 100755
--- a/src/development/genhtml.sh
+++ b/src/development/genhtml.sh
@@ -8,7 +8,11 @@ escape() {
}
url_for() {
- printf 'https://%s%s%s' "$FQDN" "$BASE_URL" "$1"
+ printf '%s%s' "$BASE_URL" "$1"
+}
+
+absolute() {
+ printf 'https://%s%s' "$FQDN" "$(cat)"
}
_() {
@@ -27,8 +31,8 @@ cat <<-EOF
<head>
<meta charset="UTF-8" />
<meta viewport content="width=device-width, initial-scale=1" />
- <link rel="stylesheet" type="text/css" href="$(url_for '/static/styles.css')" />
- <link rel="icon" type="image/svg+xml" href="$(url_for '/static/lord-favicon.svg')" />
+ <link rel="stylesheet" type="text/css" href="$(url_for 'styles.css')" />
+ <link rel="icon" type="image/svg+xml" href="$(url_for 'static/lord-favicon.svg')" />
<link rel="alternate" type="application/atom+xml" hreflang="$lang" href="$(url_for '/feed.articles.en.atom')" title="$(_ "EuAndreh's blog" | escape)" />
<link rel="alternate" type="application/atom+xml" hreflang="$lang" href="$(url_for '/feed.tils.en.atom')" title="$(_ "EuAndreh's TIL" | escape)" />
<link rel="alternate" type="application/atom+xml" hreflang="$lang" href="$(url_for '/feed.podcasts.en.atom')" title="$(_ "EuAndreh's podcasts" | escape)" />
@@ -41,16 +45,16 @@ cat <<-EOF
<meta property="og:locale" content="$lang" />
<meta property="og:title" content="$(_ 'FIXME 2')" />
- <link rel="canonical" href="$(url_for '/')" />
- <meta property="og:url" content="$(url_for '/')" />
+ <link rel="canonical" href="$(url_for '' | absolute)" />
+ <meta property="og:url" content="$(url_for '' | absolute)" />
<!-- FIXME: link to next and prev -->
</head>
<body>
<header>
<nav>
<ul>
- <a href="$(url_for "/$lang/")">$(_ 'FIXME homepage link name')</a>
- <a href="$(url_for "$(_ '/about.html')")">$(_ 'About')</a>
+ <a href="$(url_for "$lang/")">$(_ 'FIXME homepage link name')</a>
+ <a href="$(url_for "$(_ 'about.html')")">$(_ 'About')</a>
</ul>
EOF
@@ -95,12 +99,12 @@ cat <<-EOF
<footer>
<ul>
<li>
- <img class="FIXME" src="$(url_for '/static/envelog.svg' alt="FIXME")" />
+ <img class="FIXME" src="$(url_for 'static/envelope.svg' alt="FIXME")" />
<a href="mailto:eu@euandre.org">eu@euandre.org</a>
</li>
<li>
- <img class="FIXME" src="$(url_for '/static/lock.svg' alt="FIXME")" />
- <a href="$(url_for '/static/public.asc')">81F90EC3CD356060</a>
+ <img class="FIXME" src="$(url_for 'static/lock.svg' alt="FIXME")" />
+ <a href="$(url_for 'static/public.asc')">81F90EC3CD356060</a>
</li>
</ul>
<p>