aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-12-20 00:13:19 +0300
committerAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-12-20 00:13:19 +0300
commitdabea0efa5b58f6da478549d3889a56d5d1b5a09 (patch)
tree98ef67e651ad43aa467d20e6ea3e159b79a95008
parentf7c7f91ec0ffeddbfd3676cccd43edfb66c7d05d (diff)
Auto-commit 2024-12-20
-rw-r--r--.gitignore3
-rw-r--r--hugo.toml24
-rw-r--r--layouts/_default/list.gmi16
-rw-r--r--layouts/_default/single.gmi11
4 files changed, 50 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index 14119b5..a5878b9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
*.lock
-public/ \ No newline at end of file
+public/
+orion \ No newline at end of file
diff --git a/hugo.toml b/hugo.toml
index de0b253..5e623df 100644
--- a/hugo.toml
+++ b/hugo.toml
@@ -106,10 +106,28 @@ lineNos = false
lineNumbersInTable = true
tabWidth = 4
+[mediaTypes]
+[mediaTypes."text/gemini"]
+suffixes = ["gmi"]
+[mediaTypes."text/plain"]
+suffixes = ["txt"]
+
[outputs]
-page = ["html"]
-home = ["html", "json"]
-section = ["html", "rss", "json"]
+page = ["html", "gemini"]
+home = ["html", "json", "gemini"]
+section = ["html", "rss", "json", "gemini"]
+taxonomy = ["html", "gemini"]
+term = ["html", "gemini"]
+
+[outputFormats.Gemini]
+name = "gemini"
+mediaType = "text/gemini"
+baseName = "index"
+isPlainText = true
+permalinkable = true
+isHTML = false
+protocol = "gemini://"
+noUgly = true
[pagination]
disableAliases = false
diff --git a/layouts/_default/list.gmi b/layouts/_default/list.gmi
new file mode 100644
index 0000000..8560760
--- /dev/null
+++ b/layouts/_default/list.gmi
@@ -0,0 +1,16 @@
+# {{ .Title }}
+
+{{ $content := .Content -}}
+
+{{ $content := $content | replaceRE `{{<\s*(?:rel)?ref\s+"([^"]+)"\s*>}}` "$1" -}}
+{{ $content := $content | replaceRE `{{<\s*figure\s*(?:.*)?src="([^"]+)"(?:.*)?caption="([^"]+)"(?:.*)?>}}` "![$2]($1)" -}}
+{{ $content := $content | replaceRE `{{<\s*image\s*.*?src="([^"]+)".*?>}}` "![]($1)" -}}
+{{ $content := $content | replaceRE "(?s:< !--more-- >)" "" -}}
+{{ $content := $content | replace "<!-- more -->" "" -}}
+{{ $content := $content | replaceRE `\[(.+?)\]\((.+?)\)` "\n=> $2 $1\n" -}}
+
+{{ $content }}
+
+{{ range .Pages.ByPublishDate.Reverse }}
+=> {{ .RelPermalink | replaceRE `index.gmi` `` }}{{if .Date }} {{ .Date.Format "2006-01-02" }}{{ end }} {{ .Title }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi
new file mode 100644
index 0000000..10d9876
--- /dev/null
+++ b/layouts/_default/single.gmi
@@ -0,0 +1,11 @@
+# {{ .Title }}
+
+{{ $content := .RawContent -}}
+
+{{ $content := $content | replaceRE "(?s:< !--more-- >)" "" -}}
+{{ $content := $content | replaceRE `\[(.+?)\]\((.+?)\)` "\n=> $2 $1\n" -}}
+
+{{ $content }}
+
+---
+NeonXP at {{ .Date.Format "2006-01-02" }}