fix: docs <article> wrap content only

Prevents Docsearch picking up Feedback Widget text etc. in search results
This commit is contained in:
George Cushen committed 2022-09-07 22:44:54 +01:00
1 parent 0f2261995e
commit c36731acb3
1 file changed
+47 -51
@@ -26,72 +26,68 @@
<main class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 docs-content" role="main">
<article class="article">
<div class="docs-article-container">
{{ if $show_breadcrumb }}
{{ partial "components/breadcrumb" $current_page }}
{{ end }}
</div>
<div class="docs-article-container">
{{ if $show_breadcrumb }}
{{ partial "components/breadcrumb" $current_page }}
{{ end }}
</div>
{{/* Cover image */}}
{{ $cover_image := partial "functions/get_featured_image.html" . }}
{{ if $cover_image }}
<div class="article-header">
{{ $alt := (.Params.image.caption | default "") | plainify }}
{{ $cover_image = $cover_image.Fit "1800x310 webp" }}
<img src="{{$cover_image.RelPermalink}}" width="{{$cover_image.Width}}" height="{{$cover_image.Height}}" class="article-banner" alt="{{$alt}}">
{{ with (.Params.image.alt_text | default .Params.image.caption) }}
<span class="article-header-caption">{{ . | markdownify | emojify }}</span>
{{ end }}
</div>
{{end}}
{{/* Cover image */}}
{{ $cover_image := partial "functions/get_featured_image.html" . }}
{{ if $cover_image }}
<div class="article-header">
{{ $alt := (.Params.image.caption | default "") | plainify }}
{{ $cover_image = $cover_image.Fit "1800x310 webp" }}
<img src="{{$cover_image.RelPermalink}}" width="{{$cover_image.Width}}" height="{{$cover_image.Height}}" class="article-banner" alt="{{$alt}}">
{{ with (.Params.image.alt_text | default .Params.image.caption) }}
<span class="article-header-caption">{{ . | markdownify | emojify }}</span>
{{ end }}
</div>
{{end}}
<div class="docs-article-container">
{{/* Fallback to filename as title (useful for default Obsidian note structure) */}}
<h1>{{ cond (ne .File nil) (.Title | default (title .File.ContentBaseName)) .Title }}</h1>
<div class="docs-article-container">
{{/* Fallback to filename as title (useful for default Obsidian note structure) */}}
<h1>{{ cond (ne .File nil) (.Title | default (title .File.ContentBaseName)) .Title }}</h1>
<article class="article-style">
<div class="article-style">
{{/* Only auto-list page children if _index has no content (or if it isn't a .File?) */}}
{{ if and (not .Content) (gt (len $.Page.Pages) 0) }}
<ul class="list-unstyled">
{{ range $.Page.Pages }}
<li>
<h5><a href="{{.RelPermalink}}">{{.LinkTitle | default (title .File.TranslationBaseName) }}</a></h5>
{{if .Summary}}<p>{{.Summary | plainify | emojify}}</p>{{end}}
</li>
{{end}}
</ul>
{{/* Only auto-list page children if _index has no content (or if it isn't a .File?) */}}
{{ if and (not .Content) (gt (len $.Page.Pages) 0) }}
<ul class="list-unstyled">
{{ range $.Page.Pages }}
<li>
<h5><a href="{{.RelPermalink}}">{{.LinkTitle | default (title .File.TranslationBaseName) }}</a></h5>
{{if .Summary}}<p>{{.Summary | plainify | emojify}}</p>{{end}}
</li>
{{end}}
</ul>
{{end}}
{{ .Content }}
{{ .Content }}
</div>
</article>
{{ partial "components/feedback" . }}
{{ partial "components/feedback" . }}
{{ partial "tags.html" . }}
{{ partial "tags.html" . }}
{{/* Show next/previous pages by default. */}}
{{ if ne .Params.pager false }}
<div class="article-widget">
{{ partial "components/pager" . }}
</div>
{{ end }}
{{/* Show next/previous pages by default. */}}
{{ if ne .Params.pager false }}
<div class="article-widget">
{{ partial "components/pager" . }}
</div>
{{ end }}
</div>
<div class="body-footer">
<p>{{ i18n "last_updated" }} {{ $.Lastmod | time.Format site.Params.locale.date_format }}</p>
<div class="body-footer">
<p>{{ i18n "last_updated" }} {{ $.Lastmod | time.Format site.Params.locale.date_format }}</p>
{{ partial "page_edit" . }}
{{ partial "page_edit" . }}
{{ partial "comments" . }}
{{ partial "comments" . }}
{{ partial "page_related" . }}
</div>
</article>
{{ partial "page_related" . }}
</div>
{{ partial "site_footer" . }}