reuse TOC from docs on blog pages (#1286)

This commit is contained in:
trean
2024-11-14 21:31:37 +01:00
committed by GitHub
parent aa1acf0acb
commit f69c99d3b2
6 changed files with 117 additions and 143 deletions
@@ -1,4 +1,10 @@
<section class="qdrant-post {{ if eq .variant "centered" }}qdrant-post_centered{{ else if eq .variant "blog-post" }}qdrant-blog-post{{ end }}">
<section
class="qdrant-post {{ if eq .variant "centered" }}
qdrant-post_centered
{{ else if eq .variant "blog-post" }}
qdrant-blog-post
{{ end }}"
>
<article id="article" class="container">
<div class="qdrant-post__header">
<h1 class="qdrant-post__title">{{ .context.Params.title }}</h1>
@@ -26,27 +32,10 @@
<div class="qdrant-post__body">
{{ if eq .variant "blog-post" }}
<div class="qdrant-post__nav">
{{ with (.context.Site.GetPage "/headless/share-buttons") }}
<h6 class="qdrant-post__nav-title">{{ .Params.navTitle }}</h6>
{{ end }}
{{ .context.TableOfContents }}
<div class="qdrant-post__nav-links">
{{ $link := urlquery .context.Permalink }}
{{ $title := .context.Title }}
{{ with (.context.Site.GetPage "/headless/share-buttons") }}
{{ range .Params.buttons }}
{{ $url := .url | replaceRE "\\{\\{\\s*\\$link\\s*\\}\\}" $link | replaceRE "\\{\\{\\s*\\$title\\s*\\}\\}" $title }}
<a href="{{ $url }}" target="_blank" rel="noopener noreferrer" title="{{ .title }}">
{{ .icon | safeHTML }}
{{ .subtitle }}
</a>
{{ end }}
{{ end }}
</div>
</div>
{{ partial "table-of-contents" .context }}
{{ end }}
<div class="qdrant-post__content">
{{ partial "article-content" .context }}
</div>