mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 01:35:56 +01:00
Fix taxonomy pages
This commit is contained in:
parent
76cf7da9ad
commit
26e57ca402
8 changed files with 42 additions and 15 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -3,4 +3,5 @@
|
||||||
/.hugo_build.lock
|
/.hugo_build.lock
|
||||||
/.lycheecache
|
/.lycheecache
|
||||||
.env
|
.env
|
||||||
*.der
|
# Ignore Agate gemini server's files
|
||||||
|
/.certificates
|
||||||
|
|
10
Taskfile.yml
10
Taskfile.yml
|
@ -3,7 +3,7 @@
|
||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
domain: https://www.byjp.me
|
domain: www.byjp.me
|
||||||
puma_dev_tld: .test
|
puma_dev_tld: .test
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
@ -26,15 +26,15 @@ tasks:
|
||||||
port: 1313
|
port: 1313
|
||||||
cmds:
|
cmds:
|
||||||
- |
|
- |
|
||||||
[ -d "$HOME/.puma-dev/" ] && (echo {{ .port }} > $HOME/.puma-dev/www.byjp.me) || echo "Puma dev not installed, https://{{ .domain }}{{ .puma_dev_tld }} will not work"
|
[ -d "$HOME/.puma-dev/" ] && (echo {{ .port }} > $HOME/.puma-dev/{{ .domain }}) || echo "Puma dev not installed, https://{{ .domain }}{{ .puma_dev_tld }} will not work"
|
||||||
- hugo server -p {{ .port }} --minify --printUnusedTemplates -D --baseURL "{{ .domain }}{{ .puma_dev_tld }}" --appendPort=false
|
- hugo server -p {{ .port }} --minify --printUnusedTemplates -D --baseURL "https://{{ .domain }}{{ .puma_dev_tld }}" --appendPort=false
|
||||||
|
|
||||||
build:
|
build:
|
||||||
desc: Builds the production-ready site in ./public/
|
desc: Builds the production-ready site in ./public/
|
||||||
vars:
|
vars:
|
||||||
cache: /tmp/hugo/cache
|
cache: /tmp/hugo/cache
|
||||||
cmds:
|
cmds:
|
||||||
- hugo --cacheDir {{ .cache }} --gc --minify --baseURL "{{ .domain }}"
|
- hugo --cacheDir {{ .cache }} --gc --minify --baseURL "https://{{ .domain }}"
|
||||||
- pagefind
|
- pagefind
|
||||||
|
|
||||||
import:
|
import:
|
||||||
|
@ -48,4 +48,4 @@ tasks:
|
||||||
desc: Builds the site & starts a gemini server (on the default port) for it.
|
desc: Builds the site & starts a gemini server (on the default port) for it.
|
||||||
deps: [ build ]
|
deps: [ build ]
|
||||||
cmds:
|
cmds:
|
||||||
- agate --content public --lang en-GB --hostname localhost --central-conf
|
- agate --content public --lang en-GB --hostname "{{ .domain }}{{ .puma_dev_tld }}" --central-conf
|
||||||
|
|
|
@ -198,6 +198,8 @@ date = ["date", "publishDate", "lastmod", ":git"]
|
||||||
[outputs]
|
[outputs]
|
||||||
home = ["html", "rss", "gemini"]
|
home = ["html", "rss", "gemini"]
|
||||||
section = ["html", "rss", "gemini"]
|
section = ["html", "rss", "gemini"]
|
||||||
|
taxonomy = ["html", "rss", "gemini"]
|
||||||
|
term = ["html", "rss", "gemini"]
|
||||||
page = ["html", "gemini"]
|
page = ["html", "gemini"]
|
||||||
|
|
||||||
[minify]
|
[minify]
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
{{- $paginator := .Paginate .Pages -}}
|
{{- $paginator := .Paginate .Pages -}}
|
||||||
|
|
||||||
{{- range $paginator.Pages.GroupByDate "2006" }}
|
{{- $paginatorGroup := $paginator.Pages.GroupByDate "2006" -}}
|
||||||
|
{{- range $paginatorGroup }}
|
||||||
## {{ .Key }}
|
## {{ .Key }}
|
||||||
{{ range .Pages -}}
|
{{ range .Pages -}}
|
||||||
=> {{ .RelPermalink }} {{ with .Params.emoji }}{{ . }} {{ end }}{{ partial "page-title.txt" . }}
|
=> {{ .RelPermalink }} {{ with .Params.emoji }}{{ . }} {{ end }}{{ partial "page-title.txt" . }}
|
||||||
|
|
10
layouts/_default/taxonomy.gmi
Normal file
10
layouts/_default/taxonomy.gmi
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{{- define "main" -}}
|
||||||
|
# {{ with .Params.emoji }}{{.}} {{end}}{{ title (replace .Title "-" " ") }}
|
||||||
|
|
||||||
|
{{- with .Page.RenderShortcodes }}
|
||||||
|
{{- partial "markdown.gmi" . -}}{{ end }}
|
||||||
|
|
||||||
|
{{ range .Pages.ByTitle -}}
|
||||||
|
=> {{ .RelPermalink }} {{ with .Params.emoji }}{{ . }} {{ end }}{{ partial "page-title.txt" . }}
|
||||||
|
{{ end -}}
|
||||||
|
{{- end -}}
|
|
@ -1,6 +1,7 @@
|
||||||
{{- $src := path.Join (path.Dir .Page.RelPermalink) .src -}}
|
{{- $src := path.Join (path.Dir .Page.RelPermalink) .src -}}
|
||||||
{{- $title := "An untitled image" -}}
|
{{- $emoji := "🖼️" -}}
|
||||||
{{- if hasSuffix $src ".mp4" }}{{ $title = "An untitled video" }}{{ end -}}
|
{{- $title := "Linked image" -}}
|
||||||
|
{{- if hasSuffix $src ".mp4" }}{{ $title = "Linked video" }}{{- $emoji = "📼" -}}{{ end -}}
|
||||||
{{- $caption := .caption -}}
|
{{- $caption := .caption -}}
|
||||||
{{- $captionChunks := split $caption "." -}}
|
{{- $captionChunks := split $caption "." -}}
|
||||||
{{- $shortCap := index $captionChunks 0 }}
|
{{- $shortCap := index $captionChunks 0 }}
|
||||||
|
@ -9,6 +10,6 @@
|
||||||
{{- $caption = delimit (after 1 $captionChunks) "." -}}
|
{{- $caption = delimit (after 1 $captionChunks) "." -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- with .title }}{{if gt (len .) 0 }}{{ $title = . }}{{ end }}{{ end -}}
|
{{- with .title }}{{if gt (len .) 0 }}{{ $title = . }}{{ end }}{{ end -}}
|
||||||
{{ "\n=>" }} {{ $src }} {{ $title }}
|
{{ "\n=>" }} {{ $src }} {{ $emoji }} {{ $title }}
|
||||||
{{- with $caption }}{{ if ne $title . }}
|
{{- with $caption }}{{ if ne $title . }}
|
||||||
> {{ . }}{{ end }}{{ end -}}
|
> {{ . }}{{ end }}{{ end -}}
|
||||||
|
|
|
@ -15,19 +15,24 @@
|
||||||
{{/* Swap out forced newlines */}}
|
{{/* Swap out forced newlines */}}
|
||||||
{{- $content := $content | replaceRE `<br/??>` "\n" -}}
|
{{- $content := $content | replaceRE `<br/??>` "\n" -}}
|
||||||
{{- $content := $content | replaceRE `\\\n` "\n" -}}
|
{{- $content := $content | replaceRE `\\\n` "\n" -}}
|
||||||
{{/* Links */}}
|
|
||||||
{{- $content := $content | replaceRE `<a .*href="(.+?)".*>(.+?)</a>` "[$2]($1)" -}}
|
|
||||||
{{- $content := $content | replaceRE `\sgemini://(\S*)` " [gemini://$1](gemini://$1)" -}}
|
|
||||||
{{/* Horizontal rules */}}
|
{{/* Horizontal rules */}}
|
||||||
{{- $content := $content | replaceRE "\n+---\n+" "\n\n" -}}
|
{{- $content := $content | replaceRE "\n+---\n+" "\n\n" -}}
|
||||||
{{/* Images */}}
|
{{/* Images */}}
|
||||||
{{- $content := $content | replaceRE `\n\n!\[.*]\((.+?)\)` "\n\n=> $1 An untitled image" -}}
|
{{- $content := $content | replaceRE `\n\n!\[.*]\((.+?)\)` "\n\n=> $1 Linked image" -}}
|
||||||
|
|
||||||
|
{{/* Links */}}
|
||||||
|
{{- $content := $content | replaceRE `<a .*?href="(.+?)".*?>(.+?)</a>` "[$2]($1)" -}}
|
||||||
|
{{- $content := $content | replaceRE `\sgemini://(\S*)` " [gemini://$1](gemini://$1)" -}}
|
||||||
|
|
||||||
{{- $refs := findRE `\[.+?\]\([^#].+?\)` $content -}}
|
{{- $refs := findRE `\[.+?\]\([^#].+?\)` $content -}}
|
||||||
|
{{/* Remove lines that are only hashtags */}}
|
||||||
|
{{- $content := $content | replaceRE `\n(\[.+?\]\(/tags/.*\) *)+\n` "" -}}
|
||||||
|
{{/* Give hashtags a hash */}}
|
||||||
|
{{- $content := $content | replaceRE `\[(.+?)\]\(/tags/.*\)` "#$1" -}}
|
||||||
|
{{/* Give other links a subscript indicator */}}
|
||||||
{{- $content := $content | replaceRE `\[(.+?)\]\((.+?)\)` "$1⁺" -}}
|
{{- $content := $content | replaceRE `\[(.+?)\]\((.+?)\)` "$1⁺" -}}
|
||||||
|
|
||||||
{{- $content | safeHTML -}}
|
{{- $content | safeHTML -}}
|
||||||
|
|
||||||
{{- if gt (len $refs) 0 -}}
|
{{- if gt (len $refs) 0 -}}
|
||||||
{{- "\n" -}}
|
{{- "\n" -}}
|
||||||
{{- range $refs -}}
|
{{- range $refs -}}
|
||||||
|
@ -35,6 +40,7 @@
|
||||||
{{- $title := substr (index $parts 0) 1 | strings.FirstUpper -}}
|
{{- $title := substr (index $parts 0) 1 | strings.FirstUpper -}}
|
||||||
{{- $link := substr (index $parts 1) 0 (sub (len (index $parts 1)) 1) -}}
|
{{- $link := substr (index $parts 1) 0 (sub (len (index $parts 1)) 1) -}}
|
||||||
{{- if hasPrefix $link "/twitter/#" }}{{ continue }}{{ end -}}
|
{{- if hasPrefix $link "/twitter/#" }}{{ continue }}{{ end -}}
|
||||||
|
{{- if hasPrefix $link "/tags/" }}{{ $title = printf "🔗 #%s" $title }}{{ end -}}
|
||||||
=> {{ printf "%s %s\n" $link $title -}}
|
=> {{ printf "%s %s\n" $link $title -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
6
todo.md
6
todo.md
|
@ -19,6 +19,12 @@ Things I might work on within my personal blog's software.
|
||||||
- [ ] Add links to memex from §refs
|
- [ ] Add links to memex from §refs
|
||||||
- [ ] Switch Memex to single file (easier to post to)
|
- [ ] Switch Memex to single file (easier to post to)
|
||||||
- [ ] Remove http://gowal.la & https://4sq.com links and/or posts that are useless without them
|
- [ ] Remove http://gowal.la & https://4sq.com links and/or posts that are useless without them
|
||||||
|
- [ ] Gemini?!
|
||||||
|
- [x] Tags pages
|
||||||
|
- [ ] Calendar page
|
||||||
|
- [ ] Include link, location, date on event page
|
||||||
|
- [ ] Handle `<details>` in posts (example: ChefGPT)
|
||||||
|
- [ ] Actually serve it up
|
||||||
|
|
||||||
### Working
|
### Working
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue