diff options
| -rw-r--r-- | Makefile | 1 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | content/projects/_index.md | 2 | ||||
| -rw-r--r-- | layouts/partials/document-view.html | 16 | ||||
| -rw-r--r-- | layouts/partials/site-identity.html | 3 | ||||
| -rwxr-xr-x | scripts/publish-raw | 40 | ||||
| -rw-r--r-- | static/style.css | 3 |
7 files changed, 4 insertions, 63 deletions
@@ -6,7 +6,6 @@ BASE_URL ?= http://localhost:1314/ build: clean $(HUGO) --baseURL "$(BASE_URL)" - ./scripts/publish-raw serve: build $(HUGO) server --disableFastRender --disableLiveReload --port $(PORT) --baseURL "http://localhost:$(PORT)/" @@ -16,7 +16,7 @@ make serve make clean ``` -`make build` recreates `public/`, runs Hugo, and then copies every public Markdown source and its page-bundle attachments without changing their bytes. The default `BASE_URL` is `http://localhost:1314/`; pass `BASE_URL=https://example.org/` to generate absolute production URLs. `make serve` prepares that same output before starting Hugo at `http://localhost:1314/`; override the port with `make serve PORT=8080`. Hugo rebuilds HTML while serving; restart the command after editing Markdown when the raw `.md` snapshot also needs to change. +`make build` recreates `public/` and runs Hugo. Each document links to its Markdown source in the Git repository. The default `BASE_URL` is `http://localhost:1314/`; pass `BASE_URL=https://example.org/` to generate absolute production URLs. `make serve` prepares that same output before starting Hugo at `http://localhost:1314/`; override the port with `make serve PORT=8080`. Hugo rebuilds the site while serving. The source repository URL, per-file Git base URL, and public email are configured once in `hugo.toml`. diff --git a/content/projects/_index.md b/content/projects/_index.md index d2360cf..303f2f3 100644 --- a/content/projects/_index.md +++ b/content/projects/_index.md @@ -8,7 +8,7 @@ license: CC-BY-SA-4.0 ## rhomepage -A document-first personal website that publishes each article as readable HTML and unchanged Markdown. +A document-first personal website that publishes each article as readable HTML, with links to its Markdown source in the Git repository. - Technology: Hugo, HTML, CSS, POSIX shell - License: GPL-3.0-or-later diff --git a/layouts/partials/document-view.html b/layouts/partials/document-view.html index 5bfc7b6..ffe49eb 100644 --- a/layouts/partials/document-view.html +++ b/layouts/partials/document-view.html @@ -1,19 +1,5 @@ {{- if .File -}} - {{- $rawURL := "" -}} - {{- if .IsPage -}} - {{- $htmlBase := strings.TrimSuffix ".html" .RelPermalink -}} - {{- $rawURL = printf "%s/index.md" $htmlBase -}} - {{- else if .IsSection -}} - {{- $rawURL = printf "%s_index.md" .RelPermalink -}} - {{- end -}} {{- $gitBase := strings.TrimSuffix "/" site.Params.gitBase -}} {{- $gitURL := printf "%s/content/%s" $gitBase .File.Path -}} - <nav class="document-view" aria-label="Document formats"> - <span>view:</span> - <a href="{{ .RelPermalink }}" aria-current="page">html</a> - <span aria-hidden="true">·</span> - <a href="{{ $rawURL }}">raw .md</a> - <span aria-hidden="true">·</span> - <a href="{{ $gitURL }}">git</a> - </nav> + <p class="document-view"><a href="{{ $gitURL }}">source</a></p> {{- end -}} diff --git a/layouts/partials/site-identity.html b/layouts/partials/site-identity.html index 0f18d35..631969a 100644 --- a/layouts/partials/site-identity.html +++ b/layouts/partials/site-identity.html @@ -4,14 +4,13 @@ <a class="site-root" href="{{ "/" | relURL }}">{{ $identity }}</a><span class="site-separator" aria-hidden="true">/</span> {{- if not $page.IsHome -}} {{- $path := strings.TrimSuffix "/" $page.RelPermalink -}} - {{- $path = strings.TrimSuffix ".html" $path -}} {{- $prefix := "/" -}} {{- $segments := split $path "/" -}} {{- range $index, $segment := $segments -}} {{- if ne $segment "" -}} {{- $prefix = printf "%s%s/" $prefix $segment -}} {{- if eq (add $index 1) (len $segments) -}} - <a class="site-current" href="{{ $page.RelPermalink }}" aria-current="page">{{ $segment }}</a><span class="site-separator" aria-hidden="true">/</span> + <a class="site-current" href="{{ $page.RelPermalink }}" aria-current="page">{{ $segment }}</a>{{ if strings.HasSuffix $page.RelPermalink "/" }}<span class="site-separator" aria-hidden="true">/</span>{{ end }} {{- else -}} <a class="site-crumb" href="{{ $prefix | relURL }}">{{ $segment }}</a><span class="site-separator" aria-hidden="true">/</span> {{- end -}} diff --git a/scripts/publish-raw b/scripts/publish-raw deleted file mode 100755 index cc05958..0000000 --- a/scripts/publish-raw +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -set -eu - -content_dir=${1:-content} -public_dir=${2:-public} - -[ -d "$content_dir" ] || exit 0 -mkdir -p "$public_dir" - -find "$content_dir" -type f -print | while IFS= read -r source -do - relative=${source#"$content_dir"/} - - case "$relative" in - updates/_index.md) - # Updates is an aggregate index, not a published Markdown document. - continue - ;; - journal/_index.md) - target=$public_dir/journal/_index.md - ;; - journal/*/_index.md|journal/*/*/_index.md) - target=$public_dir/$relative - ;; - journal/*/*/*/*) - target=$public_dir/$relative - ;; - journal/*) - # Only source files for published journal sections and entries are public. - continue - ;; - *) - target=$public_dir/$relative - ;; - esac - - mkdir -p "$(dirname "$target")" - cp "$source" "$target" -done diff --git a/static/style.css b/static/style.css index 2dc2af2..30bc5d8 100644 --- a/static/style.css +++ b/static/style.css @@ -257,9 +257,6 @@ a:focus-visible { } .document-view { - display: flex; - flex-wrap: wrap; - gap: 0 0.55rem; margin-block: 1rem; color: var(--muted); font-size: 0.875rem; |
