Skip to content

Commit

Permalink
[Blog] Prepare for 2024 + blog navigation enhancements (#3784)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Jan 16, 2024
1 parent 69804d6 commit a810cfe
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 1 deletion.
7 changes: 7 additions & 0 deletions content/en/blog/2024/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: 2024
weight: -2024
outputs: [HTML, RSS]
---

New posts are coming soon.
2 changes: 1 addition & 1 deletion content/en/blog/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
title: Blog
menu:
main: { weight: 50 }
redirects: [{ from: '', to: '2023/ 301!' }]
# redirects: [{ from: '', to: '2024/ 301!' }]
outputs: [HTML, RSS]
---
36 changes: 36 additions & 0 deletions layouts/blog/baseof.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!doctype html>
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" class="no-js">
<head>
{{ partial "head.html" . }}
</head>
<body class="td-{{ .Kind }} td-blog {{- with .Page.Params.body_class }} {{ . }}{{ end }}">
<header>
{{ partial "navbar.html" . }}
</header>
<div class="container-fluid td-outer">
<div class="td-main">
<div class="row flex-xl-nowrap">
<aside class="col-12 col-md-3 col-xl-2 td-sidebar d-print-none">
{{ partial "sidebar.html" . }}
</aside>
<aside class="d-none d-xl-block col-xl-2 td-sidebar-toc d-print-none">
{{ partial "page-meta-links.html" . }}
{{ partial "toc.html" . }}
{{ partial "taxonomy_terms_clouds.html" . }}
</aside>
<main class="col-12 col-md-9 col-xl-8 ps-md-5 pe-md-4" role="main">
{{ with .CurrentSection.OutputFormats.Get "rss" -}}
<a class="td-rss-button" title="RSS" href="{{ .RelPermalink | safeURL }}" target="_blank" rel="noopener">
<i class="fa-solid fa-rss" aria-hidden="true"></i>
</a>
{{ end -}}
{{ if not .Site.Params.ui.breadcrumb_disable }}{{ partial "breadcrumb.html" . }}{{ end }}
{{ block "main" . }}{{ end }}
</main>
</div>
</div>
{{ partial "footer.html" . }}
</div>
{{ partial "scripts.html" . }}
</body>
</html>
51 changes: 51 additions & 0 deletions layouts/blog/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/* Docsy file override */}}

{{ define "main" -}}
{{ if (and .Parent .Parent.IsHome) -}}
{{ $.Scratch.Set "blog-pages" (where .Site.RegularPages "Section" .Section) -}}
{{ else -}}
{{$.Scratch.Set "blog-pages" .Pages -}}
{{ end -}}

<div class="td-content">
{{ $content := .Content -}}
{{ if $content -}}
<h1>{{ .Title }}</h1>
{{ $content }}
{{ end -}}

{{ if .Pages -}}
<div class="td-blog-posts">
{{ $pag := .Paginate (( $.Scratch.Get "blog-pages").GroupByDate "2006" ) -}}
{{ $numPageGroups := len $pag.PageGroups -}}
{{ range $pag.PageGroups -}}
{{ if or (not $content) (gt $numPageGroups 1)}}
<div class="h2">{{ T "post_posts_in" }} {{ .Key }}</div>
{{ end -}}
<ul class="td-blog-posts-list">
{{ range .Pages -}}
<li class="td-blog-posts-list__item">
<div class="td-blog-posts-list__body">
<h5 class="mt-0 mb-1"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h5>
<p class="mb-2 mb-md-3"><small class="text-muted">{{ .Date.Format ($.Param "time_format_blog") }} {{ T "ui_in"}} {{ .CurrentSection.LinkTitle }}</small></p>
<header class="article-meta">
{{ partial "taxonomy_terms_article_wrapper.html" . -}}
{{ if (and (not .Params.hide_readingtime) (.Site.Params.ui.readingtime.enable)) -}}
{{ partial "reading-time.html" . -}}
{{ end -}}
</header>
{{ partial "featured-image.html" (dict "p" . "w" 250 "h" 125 "class" "float-start me-3 pt-1 d-none d-md-block") -}}
<p class="pt-0 mt-0">{{ .Plain | safeHTML | truncate 250 }}</p>
<p class="pt-0"><a href="{{ .RelPermalink }}" aria-label="{{ T "ui_read_more"}} - {{ .LinkTitle }}">{{ T "ui_read_more"}}</a></p>
</div>
</li>
{{ end -}}
</ul>
{{ end -}}
</div>
<div class="td-blog-posts__pagination">
{{ template "_internal/pagination.html" . -}}
</div>
{{ end }}
</div>
{{ end -}}

0 comments on commit a810cfe

Please sign in to comment.