diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-08 21:30:23 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-08 21:30:23 +0800 |
| commit | bce6be90883b107285faa56acf0081b54daa3aa9 (patch) | |
| tree | 0893f99b5debe074f1596b6cfc6d3c86da34ca42 /layouts/journal | |
Initialize personal website
Diffstat (limited to 'layouts/journal')
| -rw-r--r-- | layouts/journal/list.html | 19 | ||||
| -rw-r--r-- | layouts/journal/single.html | 37 |
2 files changed, 56 insertions, 0 deletions
diff --git a/layouts/journal/list.html b/layouts/journal/list.html new file mode 100644 index 0000000..dd486ac --- /dev/null +++ b/layouts/journal/list.html @@ -0,0 +1,19 @@ +{{ define "main" }} + <article lang="{{ default "en" .Params.lang }}"> + <header class="document-header"> + <h1>{{ .Title }}</h1> + {{ partial "document-view.html" . }} + </header> + {{ .Content }} + {{- $pages := where site.RegularPages "Section" "journal" -}} + {{- $pages = $pages.ByDate.Reverse -}} + <ol class="document-list journal-list"> + {{- range $pages }} + <li> + <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time> + <a href="{{ .RelPermalink }}" lang="{{ .Params.lang }}">{{ .LinkTitle }}</a> + </li> + {{- end }} + </ol> + </article> +{{ end }} diff --git a/layouts/journal/single.html b/layouts/journal/single.html new file mode 100644 index 0000000..d687be1 --- /dev/null +++ b/layouts/journal/single.html @@ -0,0 +1,37 @@ +{{ define "main" }} + <article lang="{{ .Params.lang }}"> + <header class="document-header"> + <p class="document-path">{{ .RelPermalink }}</p> + <h1>{{ .Title }}</h1> + <dl class="document-meta"> + <div><dt>published</dt><dd><time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time></dd></div> + {{- with .Params.updated }} + <div><dt>updated</dt><dd><time datetime="{{ time.Format "2006-01-02" . }}">{{ time.Format "2006-01-02" . }}</time></dd></div> + {{- end }} + <div><dt>license</dt><dd>{{ .Params.license }}</dd></div> + </dl> + {{ partial "document-view.html" . }} + </header> + {{ .Content }} + {{- $pages := where site.RegularPages "Section" "journal" -}} + {{- $pages = $pages.ByDate -}} + {{- $currentIndex := -1 -}} + {{- range $index, $candidate := $pages -}} + {{- if eq $candidate.RelPermalink $.RelPermalink }}{{ $currentIndex = $index }}{{ end -}} + {{- end -}} + {{- if ge $currentIndex 0 }} + <nav class="document-navigation journal-navigation" aria-label="Journal chronology"> + <ul> + {{- if gt $currentIndex 0 }} + {{- $previous := index $pages (sub $currentIndex 1) }} + <li class="previous-link"><span class="navigation-label">previous</span><a rel="prev" href="{{ $previous.RelPermalink }}">← {{ $previous.LinkTitle }}</a></li> + {{- end }} + {{- if lt (add $currentIndex 1) (len $pages) }} + {{- $next := index $pages (add $currentIndex 1) }} + <li class="next-link"><span class="navigation-label">next</span><a rel="next" href="{{ $next.RelPermalink }}">{{ $next.LinkTitle }} →</a></li> + {{- end }} + </ul> + </nav> + {{- end }} + </article> +{{ end }} |
