Merge branch 'main' of https://github.com/elkrause/hugo-bearcub
This commit is contained in:
commit
98708a12a8
16 changed files with 398 additions and 76 deletions
47
README.md
47
README.md
|
@ -26,7 +26,7 @@ git submodule add https://github.com/clente/hugo-bearcub themes/hugo-bearcub
|
|||
To finish off, append a line to the site configuration file:
|
||||
|
||||
```sh
|
||||
echo 'theme = "hugo-bearcub"' >> config.toml
|
||||
echo 'theme = "hugo-bearcub"' >> hugo.toml
|
||||
```
|
||||
|
||||
## Features
|
||||
|
@ -85,8 +85,8 @@ have to think about it again. My `_headers` file, for example, looks like this:
|
|||
### Multilingual
|
||||
|
||||
If you need to write a blog that supports more than one language, **Bear Cub**
|
||||
has you covered! Check out the demo's [`config.toml`
|
||||
file](https://github.com/clente/hugo-bearcub/blob/main/exampleSite/config.toml)
|
||||
has you covered! Check out the demo's [`hugo.toml`
|
||||
file](https://github.com/clente/hugo-bearcub/blob/main/exampleSite/hugo.toml)
|
||||
for a sample of how you can setup multilingual support.
|
||||
|
||||
By default, the theme creates a translation button that gets disabled when the
|
||||
|
@ -107,7 +107,7 @@ already implemented:
|
|||
matter](https://gohugo.io/content-management/front-matter/). You can also add
|
||||
`render: false` to your [build
|
||||
options](https://gohugo.io/content-management/build-options/#readout) to avoid
|
||||
rendering a blank post.
|
||||
rendering blank posts.
|
||||
- Skip link: a "skip to main content" link that is temporarily invisible, but
|
||||
can be focused by people who need a keyboard to navigate the web (see [PR
|
||||
#5](https://github.com/clente/hugo-bearcub/pull/5) by
|
||||
|
@ -115,14 +115,21 @@ already implemented:
|
|||
- Reply by email: if you supply an email address, the theme creates a "Reply to
|
||||
this post by email" button at the end of every post (see Kev Quirk's [original
|
||||
implementation](https://kevquirk.com/adding-the-post-title-to-my-reply-by-email-button)).
|
||||
- `absfigure` shortcode: a shortcut to use the `figure` shortcode that also
|
||||
converts relative URLs into absolute URLs by using the `absURL` function.
|
||||
- Single-use CSS (EXPERIMENTAL): you can add some styles to a single page by
|
||||
writing the CSS you need in `assets/{custom_css}.css` and then including
|
||||
`style: "{custom_css}.css"` in the [front
|
||||
matter](https://gohugo.io/content-management/front-matter/) of said page.
|
||||
- Conditional CSS (EXPERIMENTAL): since **Bear Cub** does syntax highlighting
|
||||
without inline styles (see `config.toml` for more information), it only load
|
||||
its `syntax.css` if, and only if, a code block is actually present in the
|
||||
current page.
|
||||
without inline styles (see `hugo.toml` for more information), it only load its
|
||||
`syntax.css` if, and only if, a code block is actually present in the current
|
||||
page.
|
||||
- Alternative "Herman" style (EXPERIMENTAL): if you want to check out a more
|
||||
modern CSS style, you can change the `themeStyle` parameter to `"herman"` in
|
||||
order to activate [Herman Martinus's](https://herman.bearblog.dev/) version of
|
||||
the [Blogster Minimal](https://blogster-minimal.netlify.app/) theme for
|
||||
[Astro](https://astro.build/).
|
||||
- Dynamic social card generation (EXPERIMENTAL): if you don't add preview images
|
||||
to a post, this template will generate one based on the title. You can see an
|
||||
example below.
|
||||
|
@ -131,8 +138,8 @@ already implemented:
|
|||
|
||||
## Configuration
|
||||
|
||||
**Bear Cub** can be customized with a `config.toml` file. Check out the
|
||||
[configuration](https://github.com/clente/hugo-bearcub/blob/main/exampleSite/config.toml)
|
||||
**Bear Cub** can be customized with a `hugo.toml` file. Check out the
|
||||
[configuration](https://github.com/clente/hugo-bearcub/blob/main/exampleSite/hugo.toml)
|
||||
of the [demo](https://clente.github.io/hugo-bearcub/) for more information.
|
||||
|
||||
```toml
|
||||
|
@ -145,11 +152,6 @@ defaultContentLanguage = "en"
|
|||
# Generate a nice robots.txt for SEO
|
||||
enableRobotsTXT = true
|
||||
|
||||
# Your name. For more information on why this must be a list, see
|
||||
# https://discourse.gohugo.io/t/site-author-usage/31459/8
|
||||
[author]
|
||||
name = "John Doe"
|
||||
|
||||
# Setup syntax highlighting without inline styles. For more information about
|
||||
# why you'd want to avoid inline styles, see
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles
|
||||
|
@ -206,18 +208,29 @@ enableRobotsTXT = true
|
|||
# have the theme simply not show any link
|
||||
hideUntranslated = false
|
||||
|
||||
# (EXPERIMENTAL) This theme has two options for its CSS styles: "original" and
|
||||
# "herman". The former is what you see on Bear Cub's demo (an optimized
|
||||
# version of Hugo Bear Blog), while the latter has a more modern look based on
|
||||
# Herman Martinus's version of the Blogster Minimal theme for Astro.
|
||||
themeStyle = "original"
|
||||
|
||||
# (EXPERIMENTAL) This theme is capable of dynamically generating social cards
|
||||
# for posts that don't have `images` defined in their front matter; By setting
|
||||
# `generateSocialCard` to false, you can prevent this behavior. For more
|
||||
# information see layouts/partials/seo_tags.html
|
||||
# information see layouts/partials/social_card.html
|
||||
generateSocialCard = true
|
||||
|
||||
# Social media. Delete any item you aren't using to make sure it won't show up
|
||||
# in your website's metadata.
|
||||
[social]
|
||||
email = "me@example.com" # Added to the footer so readers can reply to posts
|
||||
[params.social]
|
||||
twitter = "example" # Twitter handle (without '@')
|
||||
facebook_admin = "0000000000" # Facebook Page Admin ID
|
||||
|
||||
# Author metadata. This is mostly used for the RSS feed of your site, but the
|
||||
# email is also added to the footer of each post
|
||||
[params.author]
|
||||
name = "John Doe" # Your name as shown in the RSS feed metadata
|
||||
email = "me@example.com" # Added to the footer so readers can reply to posts
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
|
202
assets/herman.css
Normal file
202
assets/herman.css
Normal file
|
@ -0,0 +1,202 @@
|
|||
:root {
|
||||
font-size: 62.5%; /* 10px */
|
||||
--color-dark: #181a20;
|
||||
--color-light: #fafafa;
|
||||
--color-primary: #1a8fe3;
|
||||
--size: 1rem;
|
||||
--spacing: calc(var(--size) * 2.4);
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--color-dark);
|
||||
color: var(--color-light);
|
||||
padding: 4rem;
|
||||
font-family: Avenir, 'Avenir Next LT Pro', Montserrat, Corbel, 'URW Gothic',
|
||||
source-sans-pro, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
|
||||
"Segoe UI Symbol", "Noto Color Emoji";
|
||||
font-size: calc(var(--size) * 1.8);
|
||||
line-height: 1.5;
|
||||
min-height: 80vh;
|
||||
max-width: 1600px;
|
||||
margin: 0 auto;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
header,
|
||||
main,
|
||||
footer {
|
||||
max-width: 70ch;
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
header {
|
||||
padding-bottom: var(--spacing);
|
||||
}
|
||||
|
||||
nav a, a.blog-tags {
|
||||
margin-right: calc(var(--spacing) / 2);
|
||||
}
|
||||
a.blog-tags {
|
||||
line-height: 2;
|
||||
}
|
||||
|
||||
main {
|
||||
padding-bottom: var(--spacing);
|
||||
}
|
||||
|
||||
footer {
|
||||
text-align: center;
|
||||
padding-top: var(--spacing);
|
||||
}
|
||||
|
||||
a {
|
||||
color: currentColor;
|
||||
text-decoration-color: var(--color-primary);
|
||||
text-decoration-thickness: 0.3ex;
|
||||
text-underline-offset: 0.3ex;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration-thickness: 0.4ex;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4 {
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: calc(var(--size) * 4.2);
|
||||
}
|
||||
h2 {
|
||||
font-size: calc(var(--size) * 3.4);
|
||||
}
|
||||
h3 {
|
||||
font-size: calc(var(--size) * 2.6);
|
||||
}
|
||||
h4 {
|
||||
font-size: calc(var(--size) * 1.8);
|
||||
}
|
||||
|
||||
ul,
|
||||
ol {
|
||||
padding-inline-start: var(--spacing);
|
||||
}
|
||||
li {
|
||||
margin-block-start: var(--spacing);
|
||||
}
|
||||
|
||||
blockquote {
|
||||
padding-inline-start: var(--spacing);
|
||||
border-inline-start: 0.2em solid;
|
||||
font-style: italic;
|
||||
max-width: 50ch;
|
||||
}
|
||||
|
||||
:is(h1, h2, h3, h4, blockquote) {
|
||||
margin-block-end: calc(var(--spacing) / 2);
|
||||
}
|
||||
:is(h1, h2, h3, h4) + * {
|
||||
margin-block-start: calc(var(--spacing) / 3);
|
||||
}
|
||||
:is(h1, h2, h3, h4) + :where(h2, h3, h4) {
|
||||
margin-block-start: calc(var(--spacing) * 2);
|
||||
}
|
||||
|
||||
.title {
|
||||
text-decoration: none;
|
||||
}
|
||||
.title h1 {
|
||||
font-size: calc(var(--size) * 3.4);
|
||||
margin-top: calc(var(--spacing) / 2);
|
||||
}
|
||||
|
||||
ul.blog-posts {
|
||||
list-style-type: none;
|
||||
padding: unset;
|
||||
}
|
||||
ul.blog-posts li {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
ul.blog-posts li span {
|
||||
min-width: 11ch;
|
||||
}
|
||||
|
||||
p.byline {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro',
|
||||
Menlo, Consolas, 'DejaVu Sans Mono', monospace;
|
||||
padding: 2px calc(var(--spacing) / 4);
|
||||
background-color: #282a36;
|
||||
font-size: calc(var(--size) * 1.4);
|
||||
}
|
||||
pre code {
|
||||
display: block;
|
||||
padding: var(--spacing);
|
||||
overflow-x: auto;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-moz-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid;
|
||||
border-collapse: collapse;
|
||||
border-color: var(--color-light);
|
||||
padding: calc(var(--spacing) / 2);
|
||||
}
|
||||
|
||||
.disabled {
|
||||
color: currentColor;
|
||||
cursor: not-allowed;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 600px) {
|
||||
ul.blog-posts li {
|
||||
flex-direction: row;
|
||||
gap: calc(var(--spacing) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* "Skip to main content" link */
|
||||
.skip-link {
|
||||
position: absolute;
|
||||
top: 5;
|
||||
transform: translateY(-600%);
|
||||
transition: transform 0.5s;
|
||||
background-color: #181a20;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.skip-link:focus {
|
||||
transform: translateY(0%);
|
||||
}
|
||||
|
||||
figure {
|
||||
margin-inline-start: 0em;
|
||||
margin-inline-end: 0em;
|
||||
}
|
||||
|
||||
figcaption > p {
|
||||
margin-block-start: 9px;
|
||||
text-align: center;
|
||||
font-style: italic;
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 636 KiB After Width: | Height: | Size: 6.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 359 KiB After Width: | Height: | Size: 4.5 KiB |
|
@ -134,6 +134,7 @@ ul.blog-posts li a:visited {
|
|||
|
||||
a.blog-tags {
|
||||
line-height: 2;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
h3.blog-filter {
|
|
@ -69,11 +69,11 @@
|
|||
/* Operator */ .chroma .o { color: #ff79c6 }
|
||||
/* OperatorWord */ .chroma .ow { color: #ff79c6 }
|
||||
/* Punctuation .chroma .p { } */
|
||||
/* Comment */ .chroma .c { color: #7c90d0 }
|
||||
/* CommentHashbang */ .chroma .ch { color: #7c90d0 }
|
||||
/* CommentMultiline */ .chroma .cm { color: #7c90d0 }
|
||||
/* CommentSingle */ .chroma .c1 { color: #7c90d0 }
|
||||
/* CommentSpecial */ .chroma .cs { color: #7c90d0 }
|
||||
/* Comment */ .chroma .c { color: #8491b8 }
|
||||
/* CommentHashbang */ .chroma .ch { color: #8491b8 }
|
||||
/* CommentMultiline */ .chroma .cm { color: #8491b8 }
|
||||
/* CommentSingle */ .chroma .c1 { color: #8491b8 }
|
||||
/* CommentSpecial */ .chroma .cs { color: #8491b8 }
|
||||
/* CommentPreproc */ .chroma .cp { color: #ff79c6 }
|
||||
/* CommentPreprocFile */ .chroma .cpf { color: #ff79c6 }
|
||||
/* Generic .chroma .g { } */
|
||||
|
|
|
@ -7,11 +7,6 @@ defaultContentLanguage = "en"
|
|||
# Generate a nice robots.txt for SEO
|
||||
enableRobotsTXT = true
|
||||
|
||||
# Your name. For more information on why this must be a list, see
|
||||
# https://discourse.gohugo.io/t/site-author-usage/31459/8
|
||||
[author]
|
||||
name = "John Doe"
|
||||
|
||||
# Setup syntax highlighting without inline styles. For more information about
|
||||
# why you'd want to avoid inline styles, see
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/style-src#unsafe_inline_styles
|
||||
|
@ -68,15 +63,26 @@ enableRobotsTXT = true
|
|||
# have the theme simply not show any link
|
||||
hideUntranslated = false
|
||||
|
||||
# (EXPERIMENTAL) This theme has two options for its CSS styles: "original" and
|
||||
# "herman". The former is what you see on Bear Cub's demo (an optimized
|
||||
# version of Hugo Bear Blog), while the latter has a more modern look based on
|
||||
# Herman Martinus's version of the Blogster Minimal theme for Astro.
|
||||
themeStyle = "original"
|
||||
|
||||
# (EXPERIMENTAL) This theme is capable of dynamically generating social cards
|
||||
# for posts that don't have `images` defined in their front matter; By setting
|
||||
# `generateSocialCard` to false, you can prevent this behavior. For more
|
||||
# information see layouts/partials/seo_tags.html
|
||||
# information see layouts/partials/social_card.html
|
||||
generateSocialCard = true
|
||||
|
||||
# Social media. Delete any item you aren't using to make sure it won't show up
|
||||
# in your website's metadata.
|
||||
[social]
|
||||
email = "me@example.com" # Added to the footer so readers can reply to posts
|
||||
[params.social]
|
||||
twitter = "example" # Twitter handle (without '@')
|
||||
facebook_admin = "0000000000" # Facebook Page Admin ID
|
||||
|
||||
# Author metadata. This is mostly used for the RSS feed of your site, but the
|
||||
# email is also added to the footer of each post
|
||||
[params.author]
|
||||
name = "John Doe" # Your name as shown in the RSS feed metadata
|
||||
email = "me@example.com" # Added to the footer so readers can reply to posts
|
Binary file not shown.
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 20 KiB |
|
@ -11,7 +11,7 @@
|
|||
{{- partial "seo_tags.html" . -}}
|
||||
<meta name="referrer" content="no-referrer-when-downgrade" />
|
||||
|
||||
{{ $style := resources.Get "style.css" | minify }}
|
||||
{{ $style := print (default "original" .Site.Params.themeStyle) ".css" | resources.Get | minify }}
|
||||
<link href="{{ $style.RelPermalink }}" rel="stylesheet">
|
||||
|
||||
{{ if (.Page.Store.Get "hasCodeBlock") }}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
{{ if .Params.link }}
|
||||
<a href="{{ .Params.link }}" target="_blank">{{ .Title }} ↪</a>
|
||||
{{ else }}
|
||||
<a href="{{ .Permalink }}">{{ .Title }}</a>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
{{ end }}
|
||||
</li>
|
||||
{{ else }}
|
||||
|
@ -28,7 +28,7 @@
|
|||
{{ if not .Data.Singular }}
|
||||
<div>
|
||||
{{ range .Site.Taxonomies.tags }}
|
||||
<a class="blog-tags" href="{{ .Page.Permalink }}">#{{ .Page.Title }}</a>
|
||||
<a class="blog-tags" href="{{ .Page.RelPermalink }}">#{{ lower .Page.Title }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,42 +1,72 @@
|
|||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||
{{- $pages := slice -}}
|
||||
{{- if $.IsHome -}}
|
||||
{{- $pages = where $pctx.AllPages "Kind" "page" -}}
|
||||
{{ else if $.IsSection }}
|
||||
{{- $pages = $pctx.RegularPages -}}
|
||||
{{- else -}}
|
||||
{{- $pages = $pctx.Pages -}}
|
||||
{{- end -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- end -}}
|
||||
{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
|
||||
{{- $authorEmail := "" }}
|
||||
{{- with site.Params.author }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .email }}
|
||||
{{- $authorEmail = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with site.Author.email }}
|
||||
{{- $authorEmail = . }}
|
||||
{{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
|
||||
{{- $authorName := "" }}
|
||||
{{- with site.Params.author }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .name }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with site.Author.name }}
|
||||
{{- $authorName = . }}
|
||||
{{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $pctx := . }}
|
||||
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
|
||||
{{- $pages := slice }}
|
||||
{{- if or $.IsHome $.IsSection }}
|
||||
{{- $pages = $pctx.RegularPages }}
|
||||
{{- else }}
|
||||
{{- $pages = $pctx.Pages }}
|
||||
{{- end }}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit }}
|
||||
{{- if ge $limit 1 }}
|
||||
{{- $pages = $pages | first $limit }}
|
||||
{{- end }}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
|
||||
<channel>
|
||||
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<title>{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ if not .IsHome }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||
<description>Recent content {{ if not .IsHome }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||
<generator>Hugo -- gohugo.io</generator>
|
||||
<language>{{ site.Language.LanguageCode }}</language>{{ with .Site.Author.email }}
|
||||
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
|
||||
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
|
||||
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
|
||||
<language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
|
||||
<managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
|
||||
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
|
||||
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
{{- with .OutputFormats.Get "RSS" -}}
|
||||
{{- with .OutputFormats.Get "RSS" }}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{- end -}}
|
||||
{{ range $pages }}
|
||||
{{- end }}
|
||||
{{- range $pages }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Params.author }}<author>{{.}}</author>{{ end }}
|
||||
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Summary | plainify }}</description>
|
||||
<description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>
|
||||
<content:encoded>{{ `<![CDATA[` | safeHTML }}{{ .Content | safeHTML }}{{ `]]>` | safeHTML }}</content:encoded>
|
||||
</item>
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
</channel>
|
||||
</rss>
|
||||
</rss>
|
||||
|
|
|
@ -13,10 +13,10 @@
|
|||
</content>
|
||||
<p>
|
||||
{{ range (.GetTerms "tags") }}
|
||||
<a class="blog-tags" href="{{ .Permalink }}">#{{ .LinkTitle }}</a>
|
||||
<a class="blog-tags" href="{{ .RelPermalink }}">#{{ lower .LinkTitle }}</a>
|
||||
{{ end }}
|
||||
</p>
|
||||
{{ with .Site.Social.email }}
|
||||
{{ with .Site.Params.author.email }}
|
||||
<p>
|
||||
<a href='mailto:{{ . }}?subject={{ i18n "email-subject" }}"{{ default $.Site.Title $.Page.Title }}"'>
|
||||
{{ i18n "email-reply" }} ↪
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<a class="skip-link" href="#main-content">{{ i18n "skip-link" }}</a>
|
||||
|
||||
<a href="{{ relURL .Site.Home.Permalink }}" class="title"><h1>{{ .Site.Title }}</h1></a>
|
||||
<a href="{{ relURL .Site.Home.RelPermalink }}" class="title"><h1>{{ .Site.Title }}</h1></a>
|
||||
<nav>{{- partial "nav.html" . -}}</nav>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<!-- Create a link to every translation -->
|
||||
{{ range where .Site.Languages "Lang" "!=" .Page.Lang }}
|
||||
{{ with (index $translations .Lang) }}
|
||||
<a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
|
||||
<a href="{{ .RelPermalink }}">{{ .Language.LanguageName }}</a>
|
||||
{{ else }}
|
||||
<!-- The complicated setup was necessary to make a grayed out link -->
|
||||
{{ if not .Params.hideUntranslated }}
|
||||
|
|
|
@ -3,22 +3,33 @@
|
|||
{{ $fg := resources.Get "images/social_card_fg.png"}}
|
||||
{{ $bg := resources.Get "images/social_card_bg.png"}}
|
||||
|
||||
{{ $fg = $fg.Filter (images.Text .Title (dict
|
||||
{{ if gt (len .Title) 45 }}
|
||||
{{ $fg = $fg.Filter (images.Text .Title (dict
|
||||
"font" $font
|
||||
"color" "#f8f8f2"
|
||||
"color" "#fafafa"
|
||||
"size" 95
|
||||
"linespacing" 16
|
||||
"x" 0
|
||||
"y" 0
|
||||
)) }}
|
||||
{{ else }}
|
||||
{{ $fg = $fg.Filter (images.Text .Title (dict
|
||||
"font" $font
|
||||
"color" "#fafafa"
|
||||
"size" 130
|
||||
"linespacing" 20
|
||||
"x" 0
|
||||
"y" 0
|
||||
)) }}
|
||||
)) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $date := .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }}
|
||||
{{ $author := (default $.Site.Author.name ($.Param "author") ) }}
|
||||
{{ $author := (default $.Site.Params.author.name ($.Param "author") ) }}
|
||||
{{ $byline := (printf "%s | %s" $author $date) }}
|
||||
|
||||
{{ $fg = $fg.Filter (images.Text $byline (dict
|
||||
"font" $font
|
||||
"color" "#c9d1d9"
|
||||
"color" "#898a8d"
|
||||
"size" 60
|
||||
"linespacing" 30
|
||||
"x" 0
|
||||
|
@ -29,7 +40,7 @@
|
|||
{{ $card := $card.Resize "900x webp q100" }}
|
||||
|
||||
<!-- Open Graph / Facebook -->
|
||||
<!-- Source: https://raw.githubusercontent.com/gohugoio/hugo/master/tpl/tplimpl/embedded/templates/opengraph.html -->
|
||||
<!-- Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/opengraph.html -->
|
||||
<meta property="og:title" content="{{ .Title }}" />
|
||||
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
|
||||
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
|
||||
|
@ -63,22 +74,52 @@
|
|||
{{ end }}{{ end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Deprecate site.Social.facebook_admin in favor of site.Params.social.facebook_admin */}}
|
||||
{{- $facebookAdmin := "" }}
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- $facebookAdmin = .facebook_admin }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with site.Social.facebook_admin }}
|
||||
{{- $facebookAdmin = . }}
|
||||
{{- warnf "The social key in site configuration is deprecated. Use params.social.facebook_admin instead." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Facebook Page Admin ID for Domain Insights */}}
|
||||
{{- with .Site.Social.facebook_admin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
|
||||
{{ with $facebookAdmin }}<meta property="fb:admins" content="{{ . }}" />{{ end }}
|
||||
|
||||
<!-- Twitter -->
|
||||
<!-- Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/twitter_cards.html -->
|
||||
<meta name="twitter:card" content="summary_large_image"/>
|
||||
<meta name="twitter:image" content="{{ $card.Permalink | absURL }}"/>
|
||||
|
||||
<meta name="twitter:title" content="{{ .Title }}"/>
|
||||
<meta name="twitter:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}"/>
|
||||
{{ with .Site.Social.twitter -}}
|
||||
<meta name="twitter:site" content="@{{ . }}"/>
|
||||
{{ end -}}
|
||||
|
||||
{{- /* Deprecate site.Social.twitter in favor of site.Params.social.twitter */}}
|
||||
{{- $twitterSite := "" }}
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- $twitterSite = .twitter }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- with site.Social.twitter }}
|
||||
{{- $twitterSite = . }}
|
||||
{{- warnf "The social key in site configuration is deprecated. Use params.social.twitter instead." }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with $twitterSite }}
|
||||
{{- $content := . }}
|
||||
{{- if not (strings.HasPrefix . "@") }}
|
||||
{{- $content = printf "@%v" $twitterSite }}
|
||||
{{- end }}
|
||||
<meta name="twitter:site" content="{{ $content }}"/>
|
||||
{{- end }}
|
||||
|
||||
<!-- Microdata -->
|
||||
<!-- Source: https://raw.githubusercontent.com/gohugoio/hugo/master/tpl/tplimpl/embedded/templates/schema.html -->
|
||||
<!-- Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/schema.html -->
|
||||
<meta itemprop="name" content="{{ .Title }}">
|
||||
<meta itemprop="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
|
||||
|
||||
|
|
29
layouts/shortcodes/absfigure.html
Normal file
29
layouts/shortcodes/absfigure.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
|
||||
{{- if .Get "link" -}}
|
||||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||
{{- end -}}
|
||||
<img src="{{ .Get "src" | absURL}}"
|
||||
{{- if or (.Get "alt") (.Get "caption") }}
|
||||
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
|
||||
{{- end -}}
|
||||
{{- with .Get "width" }} width="{{ . }}"{{ end -}}
|
||||
{{- with .Get "height" }} height="{{ . }}"{{ end -}}
|
||||
{{- with .Get "loading" }} loading="{{ . }}"{{ end -}}
|
||||
/><!-- Closing img tag -->
|
||||
{{- if .Get "link" }}</a>{{ end -}}
|
||||
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
|
||||
<figcaption>
|
||||
{{ with (.Get "title") -}}
|
||||
<h4>{{ . }}</h4>
|
||||
{{- end -}}
|
||||
{{- if or (.Get "caption") (.Get "attr") -}}<p>
|
||||
{{- .Get "caption" | markdownify -}}
|
||||
{{- with .Get "attrlink" }}
|
||||
<a href="{{ . }}">
|
||||
{{- end -}}
|
||||
{{- .Get "attr" | markdownify -}}
|
||||
{{- if .Get "attrlink" }}</a>{{ end }}</p>
|
||||
{{- end }}
|
||||
</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
Loading…
Add table
Add a link
Reference in a new issue