Introduction
Introduction Statistics Contact Development Disclaimer Help
small fixes, configurable language support - static-site-scripts - static site …
git clone git://git.codemadness.org/static-site-scripts
Log
Files
Refs
README
LICENSE
---
commit 20caaadb4840307b4601a4ff4019c2efd93bdb53
parent e6a8d78a5f661e240dc0f2c61e271975d4b0f2e3
Author: Hiltjo Posthuma <[email protected]>
Date: Wed, 5 Mar 2014 21:06:23 +0100
small fixes, configurable language support
Signed-off-by: Hiltjo Posthuma <[email protected]>
Diffstat:
M generate.sh | 33 +++++++++++++++++------------…
1 file changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/generate.sh b/generate.sh
@@ -1,6 +1,8 @@
#!/bin/sh
# site title (part of ${pagetitle} probably).
sitetitle="Codemadness"
+# site language.
+sitelang="en"
# main site domain.
sitedomain="http://www.codemadness.nl"
# relative site url, can be "/blog" or something.
@@ -18,7 +20,7 @@ siteauthor="hiltjo"
# site last updated (default use date when script was run).
siteupdated=$(date "+%Y-%m-%dT%H:%M:%SZ")
# Directories containing content and metadata.
-# NOTE: it's recommended to use absolute paths here.
+# NOTE: it's recommended to use absolute paths here, use "." for current direc…
pagesdir="pages"
# Output dir.
outputdir="output"
@@ -57,7 +59,7 @@ pageheader() {
fi
cat <<!__EOF__
<!DOCTYPE HTML>
-<html dir="ltr" lang="en">
+<html dir="ltr" lang="${sitelang}">
<head>
<title>${pagetitle}</title>
<link rel="stylesheet" href="style.css" type="text/css" media=…
@@ -66,7 +68,7 @@ pageheader() {
<link rel="alternate" type="application/atom+xml" title="${sit…
<link rel="icon" type="image/png" href="/favicon.png" />
<meta http-equiv="Content-Type" content="text/html; charset=UT…
- <meta http-equiv="Content-Language" content="en" />
+ <meta http-equiv="Content-Language" content="${sitelang}" />
<meta content="width=device-width" name="viewport" />
<meta content="${keywords}" name="keywords" />
<meta content="${description}" name="description" />
@@ -76,15 +78,15 @@ pageheader() {
<div id="menuwrap">
<div id="menu">
<span id="links">
- <a href="${siteurlrel}/index.html" tit…
- <a href="/downloads/projects/" title="…
+ <a href="index.html" title="Blog">Blog…
+ <a href="http://git.codemadness.org/" …
<a href="https://github.com/hiltjo/" t…
</span>
<span id="links-contact">
<span class="hidden"> | </span>
- <a href="rss.xml" title="Syndicate thi…
- <a href="atom.xml" title="Atom feed" c…
- <a href="mailto:${sitemail}" title="Ma…
+ <a href="rss.xml" title="RSS feed">RSS…
+ <a href="atom.xml" title="Atom feed">A…
+ <a href="mailto:${sitemail}" title="Ma…
</span>
</div>
</div>
@@ -124,7 +126,7 @@ while read -r meta; do
datecreated=$(printf '%s' "${timecreated}" | cut -b 1-10)
dateupdated=$(printf '%s' "${timeupdated}" | cut -b 1-10)
- # if ${id} is empty and title is set generate id.
+ # if ${id} is empty and title is set: create id based on title.
if [ "${id}" = "" ] && [ ! "${title}" = "" ]; then
id=$(makeid "${title}")
fi
@@ -162,7 +164,7 @@ while read -r meta; do
# index / posts item: append.
contentindex="${contentindex}$(cat <<!__EOF__
- <tr><td class="lm">${dateupdated}</td>
+ <tr><td>${dateupdated}</td>
<td><a href="${url}" title="${description}">${title}</a></td><…
!__EOF__
)"
@@ -206,14 +208,15 @@ while read -r meta; do
# sitemap: sitemap.xml, append item.
contentsitemap="${contentsitemap}<url><loc>${urlfull}</loc></url>"
- # sitemap: urllist.txt, append item write directly to file.
+ # sitemap: urllist.txt, append item, write directly to file.
printf '%s\n' "${urlfull}" >> "${outputdir}/urllist.txt"
done <<!FILELIST
$(find "${pagesdir}" -type f -name "*.sh" | sort -rn)
!FILELIST
# process pages (reverse numeric order).
-# above heredoc is used to make sure content* variables are known
-# in this scope after the while loop.
+# NOTE: above heredoc is used to make sure content* variables are known
+# in the scope after the while loop (subshell / pipes prevents this in a
+# standard manner).
# index page.
page_reset
@@ -235,7 +238,7 @@ cat <<!__EOF__ > "${outputdir}/rss.xml"
<title>${sitetitle}</title>
<link>${siteurlfull}</link>
<description>${sitedescription}</description>
- <language>en</language>
+ <language>${sitelang}</language>
${contentrss}
</channel>
</rss>
@@ -244,7 +247,7 @@ cat <<!__EOF__ > "${outputdir}/rss.xml"
# Atom
cat <<!__EOF__ > "${outputdir}/atom.xml"
<?xml version="1.0" encoding="UTF-8"?>
-<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
+<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="${sitelang}">
<title type="text">${sitetitle}</title>
<subtitle type="text">${sitedescription}</subtitle>
<updated>${siteupdated}</updated>
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.