Commit basic working example
This commit is contained in:
45
layouts/partials/featured.html
Normal file
45
layouts/partials/featured.html
Normal file
@ -0,0 +1,45 @@
|
||||
{{ $dateFormat := default "Mon Jan 2, 2006" (index .Site.Params "date_format") }}
|
||||
|
||||
<div class="p-4 p-md-5 mb-4 text-white rounded bg-dark">
|
||||
<div class="col-md-6 px-0">
|
||||
<h1 class="display-4 font-italic">Title of a longer featured blog post</h1>
|
||||
<p class="lead my-3">Multiple lines of text that form the lede, informing new readers quickly and efficiently about what’s most interesting in this post’s contents.</p>
|
||||
<p class="lead mb-0"><a href="#" class="text-white fw-bold">Continue reading...</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-2">
|
||||
{{ range first 2 (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) | shuffle }}
|
||||
<div class="col-md-6">
|
||||
<div class="row g-0 border rounded overflow-hidden flex-md-row mb-4 shadow-sm h-md-300 position-relative">
|
||||
<div class="col p-4 d-flex flex-column position-static">
|
||||
<strong class="d-inline-block mb-2 text-primary">World</strong>
|
||||
<h3 class="mb-0">{{ .Title }}</h3>
|
||||
<div class="mb-1 text-muted">{{ if not .PublishDate.IsZero }}<time {{ .Date.Format "2006-01-02T15:04:05Z07:00" | printf "datetime=%q" | safeHTMLAttr }}>{{ .Date.Format $dateFormat }}</time>{{ end }}</div>
|
||||
<p class="card-text mb-auto">{{ substr .Description 0 110 }}</p>
|
||||
<a href="{{ .Permalink }}" class="stretched-link">Continue reading</a>
|
||||
</div>
|
||||
<div class="col-auto d-none d-lg-block">
|
||||
{{ range first 1 (.Resources.ByType "image") }}
|
||||
{{/* get a local variable for the image because we will change context below */}}
|
||||
{{ $image := . }}
|
||||
{{/* set orientation to 1 just in case it doesnt exist in Exif */}}
|
||||
{{ $orientation := 1 }}
|
||||
{{ with .Exif }}
|
||||
{{ $orientation = .Tags.Orientation }}
|
||||
{{ if eq $orientation 8 }}
|
||||
{{/* Rotate image before cropping because Hugo's "Smart" cropping crops differently if we do it at the same time as .Fill with a rotation) and use 2x dimensions to keep the thumbnail crisp */}}
|
||||
{{ $RotatedImage := $image.Resize "480x600 r90" }}
|
||||
<img src={{ ($RotatedImage.Fill "480x600").RelPermalink }} width="240" height="300" />
|
||||
{{ else }}
|
||||
<img src={{ ($image.Fill "480x600").RelPermalink }} width="240" height="300" />
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{- /* vim: set ts=2 sw=2 et: */}}
|
10
layouts/partials/footer.html
Normal file
10
layouts/partials/footer.html
Normal file
@ -0,0 +1,10 @@
|
||||
<footer class="blog-footer">
|
||||
{{ if .Site.Copyright }}
|
||||
{{ .Site.Copyright | markdownify }}
|
||||
{{ else }}
|
||||
<p>Blog template built for <a href="https://getbootstrap.com/">Bootstrap</a> by <a href="https://twitter.com/mdo">@mdo</a>, ported to Hugo by <a href='https://twitter.com/mralanorth'>@mralanorth</a>.</p>
|
||||
{{ end }}
|
||||
<p>
|
||||
<a href="#">Back to top</a>
|
||||
</p>
|
||||
</footer>
|
21
layouts/partials/head-meta.html
Normal file
21
layouts/partials/head-meta.html
Normal file
@ -0,0 +1,21 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
|
||||
{{- with .Site.Params.google_verify_meta -}}
|
||||
<meta name="google-site-verification" content="{{ . }}" />
|
||||
{{ end }}
|
||||
|
||||
{{- with .Site.Params.bing_verify_meta -}}
|
||||
<meta name="msvalidate.01" content="{{ . }}" />
|
||||
{{ end }}
|
||||
|
||||
{{- with .Site.Params.yandex_verify_meta -}}
|
||||
<meta name="yandex-verification" content="{{ . }}" />
|
||||
{{ end }}
|
||||
|
||||
{{- .Site.Hugo.Generator -}}
|
||||
|
||||
{{- /* vim: set ts=2 sw=2 et: */}}
|
8
layouts/partials/meta-terms.html
Normal file
8
layouts/partials/meta-terms.html
Normal file
@ -0,0 +1,8 @@
|
||||
{{ if .Params.categories }}
|
||||
{{ range $index, $category := .Params.categories }}{{ if gt $index 0 }}, {{ end }}<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}/" rel="category tag">{{ . }}</a>{{ end }}
|
||||
{{ end }}
|
||||
{{ if .Params.tags }}
|
||||
{{ range $index, $tag := .Params.tags }}{{ if gt $index 0 }}, {{ end }}<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}/" rel="tag">{{ . }}</a>{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{- /* vim: set ts=2 sw=2 et: */}}
|
16
layouts/partials/pagination.html
Normal file
16
layouts/partials/pagination.html
Normal file
@ -0,0 +1,16 @@
|
||||
<nav class="blog-pagination">
|
||||
{{ if and (.Paginator.HasPrev) (.Paginator.HasNext) }}
|
||||
<a class="btn btn-outline-primary" href="{{ .Paginator.Prev.URL }}" rel="prev" role="button">Older</a>
|
||||
<a class="btn btn-outline-primary" href="{{ .Paginator.Next.URL }}" rel="next" role="button">Newer</a>
|
||||
{{ end }}
|
||||
{{ if and (.Paginator.HasPrev) (not .Paginator.HasNext) }}
|
||||
<a class="btn btn-outline-primary" href="{{ .Paginator.Prev.URL }}" rel="prev" role="button">Older</a>
|
||||
<a class="btn btn-outline-primary disabled" href="#" role="button" aria-disabled="true">Newer</a>
|
||||
{{ end }}
|
||||
{{ if and (not .Paginator.HasPrev) (.Paginator.HasNext) }}
|
||||
<a class="btn btn-outline-primary disabled" href="#" role="button" aria-disabled="true">Older</a>
|
||||
<a class="btn btn-outline-primary" href="{{ .Paginator.Next.URL }}" rel="next" role="button">Newer</a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
|
||||
{{- /* vim: set ts=2 sw=2 et: */}}
|
9
layouts/partials/recent.html
Normal file
9
layouts/partials/recent.html
Normal file
@ -0,0 +1,9 @@
|
||||
<div class="p-4">
|
||||
<h4 class="font-italic">Archives</h4>
|
||||
<ol class="list-unstyled mb-0">
|
||||
{{ $num_recent_posts := (index .Site.Params.sidebar "num_recent_posts" | default 5) }}
|
||||
{{ range first $num_recent_posts (where .Site.RegularPages "Section" "in" .Site.Params.mainSections) }}
|
||||
<li><a href="{{.RelPermalink}}">{{.Title | markdownify }}</a></li>
|
||||
{{ end }}
|
||||
</ol>
|
||||
</div>
|
25
layouts/partials/sidebar.html
Normal file
25
layouts/partials/sidebar.html
Normal file
@ -0,0 +1,25 @@
|
||||
<div class="col-md-4">
|
||||
{{ if and (.Site.Params.sidebar) (isset .Site.Params.sidebar "about") }}
|
||||
<div class="p-4 mb-3 bg-light rounded">
|
||||
<h4 class="font-italic">About</h4>
|
||||
<p class="mb-0">{{ .Site.Params.sidebar.about | markdownify }}</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.sidebar }}
|
||||
{{ partialCached "recent.html" .}}
|
||||
{{ end }}
|
||||
|
||||
{{ with .Site.Menus.sidebar }}
|
||||
<div class="p-4">
|
||||
<h4 class="font-italic">Elsewhere</h4>
|
||||
<ol class="list-unstyled">
|
||||
{{ range . }}
|
||||
<li><a href="{{ .URL | absURL }}">{{ .Name }}</a></li>
|
||||
{{ end }}
|
||||
</ol>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{- /* vim: set ts=2 sw=2 et: */}}
|
Reference in New Issue
Block a user