diff options
| author | Arne Rief <riearn@proton.me> | 2025-09-01 21:57:30 +0200 |
|---|---|---|
| committer | Arne Rief <riearn@proton.me> | 2025-09-01 21:57:30 +0200 |
| commit | ade244c72af62827c4c30151404abf755597f243 (patch) | |
| tree | 1d6c5c3b24912ab5e5665bad06bb07b1f43c77ac /layouts | |
| parent | dac4024abcfea76f14522a84bee4b7258c37b72d (diff) | |
Search & socials
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/list.html | 28 | ||||
| -rw-r--r-- | layouts/_default/search.html | 69 | ||||
| -rw-r--r-- | layouts/index.json | 14 | ||||
| -rw-r--r-- | layouts/partials/footer.html | 42 | ||||
| -rw-r--r-- | layouts/partials/header.html | 4 | ||||
| -rw-r--r-- | layouts/partials/select-language.html (renamed from layouts/partials/selectLanguage.html) | 0 | ||||
| -rw-r--r-- | layouts/partials/select-theme.html (renamed from layouts/partials/selectTheme.html) | 0 |
7 files changed, 141 insertions, 16 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 8ff9b18..d3d2d99 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,28 +1,34 @@ {{- define "main" }} -<section class="section-list"> - <header class="section-list__header"> - <h1 class="section-list__headline"> +<section class="list-page"> + <header class="list-page__header"> + <h1 class="list-page__headline"> {{ .Title }} </h1> + {{- with .Content }} + <div class="list-page__description"> + {{ . }} + </div> + {{- else }} {{- $description := or .Description .Summary (lang.Translate "list.default_description" .Title | default (printf "All posts in %s" .Title)) }} - <p class="section-list__description"> - {{ $description }} - </p> + <p class="list-page__description"> + {{ $description }} + </p> + {{- end }} </header> - <section class="section-list__content" aria-label="{{ lang.Translate "posts.name" | default "Posts" }}"> + <section class="list-page__content" aria-label="{{ lang.Translate "posts.name" | default "Posts" }}"> {{- /* 20 posts per site */ -}} {{- $paginator := .Paginate .Pages 20 }} {{- with $paginator.Pages }} - <ul class="section-list__posts"> + <ul class="list-page__posts-list"> {{- range . }} - <li class="section-list__post"> + <li class="list-page__post"> {{- partial "list/post-card.html" . }} </li> {{- end }} </ul> - {{- else }} - <p class="section-list__empty-message"> + {{ else }} + <p class="list-page__empty-message"> {{ lang.Translate "list.empty" | default "No posts found in this section." }} </p> {{- end }} diff --git a/layouts/_default/search.html b/layouts/_default/search.html new file mode 100644 index 0000000..569cc9a --- /dev/null +++ b/layouts/_default/search.html @@ -0,0 +1,69 @@ +{{ define "main" }} +<section class="search-page"> + <header class="search-page__header"> + <h1 class="search-page__heading"> + {{ .Title }} + </h1> + {{- with .Content }} + <div class="search-page__description"> + {{ . }} + </div> + {{- else }} + {{- $description := or .Description (lang.Translate "search.description" | default "Find posts by search term.") }} + <p class="search-page__description"> + {{ $description }} + </p> + {{- end }} + </header> + + <section class="search-page__container" aria-label="{{ lang.Translate "search.label" | default "Search all posts" }}"> + <form id="search-form" class="search-form" role="search" autocomplete="off"> + <label for="search-input" class="search-form__label"> + {{ lang.Translate "search.label" | default "Search all posts" }} + </label> + <div class="search-form__input-wrapper"> + <input + id="search-input" + class="search-form__input" + type="search" + data-index-url="{{ site.Home.RelPermalink }}index.json" + placeholder="{{ lang.Translate "search.placeholder" | default "Type to search..." }}" + /> + <button + id="search-reset" + type="button" + class="search-form__reset" + aria-label="{{ lang.Translate "search.reset" | default "Clear search" }}" + > + <span class="search-clear__icon" aria-hidden="true">×</span> + </button> + </div> + </form> + + </section> + + <div id="search-results" class="search-page__results" aria-live="polite"> + <p class="search-results__count" hidden> + <span id="search-results-number">0</span> + {{ lang.Translate "search.matches" | default "matches" }} + </p> + + <ul class="search-results__list" hidden></ul> + + {{- /* Hidden template, used for hydrating search results from index.json with JS */ -}} + <template id="search-result-template"> + {{- $mockPost := dict + "Title" "TEMPLATE_TITLE" + "RelPermalink" "TEMPLATE_URL" + "Date" now + "Summary" "TEMPLATE_SUMMARY" + "Params" (dict "tags" (slice "TEMPLATE_TAG")) + -}} + <li class="search-results__list-item"> + {{- partial "list/post-card.html" $mockPost }} + </li> + </template> + + </div> +</section> +{{ end }} diff --git a/layouts/index.json b/layouts/index.json new file mode 100644 index 0000000..29d7e14 --- /dev/null +++ b/layouts/index.json @@ -0,0 +1,14 @@ +{{- $allPages := slice -}} + +{{- range (where site.RegularPages "Section" "!=" "") -}} + {{- $currentPage := dict + "title" .Title + "summary" (.Summary | plainify | htmlUnescape) + "url" .RelPermalink + "date" (.Date.Format "2006-01-02T15:04:05Z07:00") + "tags" .Params.tags + -}} + {{- $allPages = $allPages | append $currentPage -}} +{{- end -}} + +{{ jsonify $allPages }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 7225d09..9b66758 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,7 +1,43 @@ <footer class="site__footer" role="contentinfo"> <p>© {{ now.Year }} {{ site.Params.author.name }}</p> - <a href="{{ site.Home.Permalink }}index.xml" aria-label="RSS Feed" title="RSS Feed"> - <img src="/rss.svg" class="icon icon-rss" style="max-height: 32px" alt="RSS Feed" aria-hidden="true"> - </a> + <nav class="follow-me-links" aria-label="Follow me on:"> + <ul class="follow-me-list"> + {{- range site.Params.socials }} + <li class="follow-me-item"> + <a + href="{{ .url }}" + aria-label="{{ .name }}" + title="{{ .name }}" + rel="me noopener noreferrer" + target="_blank" + > + <img + src="{{ .icon }}" + class="icon icon-{{ lower .name }}" + style="max-height: 32px" + alt="{{ .name }}" + aria-hidden="true" + /> + </a> + </li> + {{- end }} + <li class="follow-me-item"> + <a + href="{{ site.Home.Permalink }}index.xml" + aria-label="RSS Feed" + title="RSS Feed" + target="_blank" + > + <img + src="/rss.svg" + class="icon icon-rss" + style="max-height: 32px" + alt="RSS Feed" + aria-hidden="true" + /> + </a> + </li> + </ul> + </nav> </footer> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 9195345..0f3cfce 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -7,6 +7,6 @@ {{- end }} </a> - {{- partial "selectTheme.html" . }} - {{- partial "selectLanguage.html" . }} + {{- partial "select-theme.html" . }} + {{- partial "select-language.html" . }} </header> diff --git a/layouts/partials/selectLanguage.html b/layouts/partials/select-language.html index 752b605..752b605 100644 --- a/layouts/partials/selectLanguage.html +++ b/layouts/partials/select-language.html diff --git a/layouts/partials/selectTheme.html b/layouts/partials/select-theme.html index e9114cc..e9114cc 100644 --- a/layouts/partials/selectTheme.html +++ b/layouts/partials/select-theme.html |
