Compare commits

...

11 commits

Author SHA1 Message Date
Ramiro Morales 33fbda0e9d
Fix render breakage introduced in #665 (#685)
A bare bones setup of two pages and two posts gets broken because of a
template change missed in #665

Fatal error message in readable form:
```
ERROR render:
failed to render pages:
render of "home" failed: "/themes/ananke/layouts/index.html:48:23":
execute of template failed:
template:
index.html:48:23:
executing "main" at <.Site.GetPage>: can't evaluate field Site in type string
```

Steps to reproduce:

```shell
hugo new site quickstart
cd quickstart
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
echo "theme = 'ananke'" >> hugo.toml
echo -e "+++\ntitle='Home'\n+++\n\nMain page" > content/_index.md
echo Foo. > content/page1.md
echo Bar > content/page2.md
mkdir -p content/post
echo "First post." > content/post/post1.md
echo "Second post." > content/post/post2.md
hugo server
Watching for changes in .../quickstart/{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in .../quickstart/hugo.toml, ...quickstart/themes/ananke/config.yaml
Start building sites …
hugo v0.125.3-474c4c02212cf97712c6fbf4159c68822ea6e078+extended darwin/amd64 BuildDate=2024-04-22T17:18:35Z VendorInfo=brew

Built in 67 ms
Error: error building site: render: failed to render pages: render of "home" failed: ".../quickstart/themes/ananke/layouts/index.html:48:23": execute of template failed: template: index.html:48:23: executing "main" at <.Site.GetPage>: can't evaluate field Site in type string
```
2024-05-03 13:43:35 -04:00
Blackeye f34c219436
Contribution: fix hard-coded link to section #664 (#665)
* allow_multiple_mainsection

* removed comment

---------

Co-authored-by: Blackeye <>
2024-04-18 11:26:30 -04:00
Johannes Arnold 0d068637cc
Include authors meta tag (#634) 2024-04-18 11:23:24 -04:00
Joe Mooring 91df000ca8
Access Disqus shortname from canonical location (#660) 2023-11-22 11:05:23 -05:00
mathew bd759431a9
Add missing "read more" link to summary.html (#658)
* Add missing "read more" link to summary.html

* Fix layouts/post/summary to add read more link
2023-11-21 15:08:47 -05:00
mathew 64dc2b6dea
Fix capitalization of single header for a11y (#657)
Thank you!
2023-11-21 15:06:16 -05:00
Joris Conijn 221a0d8817
feat: add canonical url support (#650)
When you want to publish content that is already published on a different site. You need to reference a canonical url of the original content.
By defining the `canonicalUrl` in the front matter definition the canonical url is set in the headers.
2023-11-21 14:41:58 -05:00
stigh 4ea29d886c
fix: in Norwegian translation use imperative form 'Send', consistent capitalization of 'Beskjed' (#639) 2023-11-21 14:36:10 -05:00
Petr Vála 9276a90cfa
localization: Create Czech (cs) localization (#626) 2023-11-21 14:30:49 -05:00
Melroy van den Berg 9808cf6cf0
Update setup guide link (#618) 2023-11-21 14:25:45 -05:00
Melroy van den Berg c086834f0e
Change to /intent/tweet (#652)
Change from /share to /intent/tweet.
2023-09-19 11:47:32 -04:00
9 changed files with 150 additions and 66 deletions

View file

@ -76,7 +76,7 @@ Inside the folder of your Hugo site run:
``` ```
$ git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke $ git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke.git themes/ananke
``` ```
For more information read the official [setup guide](//gohugo.io/overview/installing/) of Hugo. For more information read the official [setup guide](//gohugo.io/getting-started/quick-start/) of Hugo.
@ -96,9 +96,16 @@ You may need to delete the line: `themesDir = "../.."`
To enable comments, add following to your config file: To enable comments, add following to your config file:
- DISQUS: `disqusShortname = YOURSHORTNAME` - DISQUS:
- COMMENTO:
```toml
[services.disqus]
shortname = 'YOURSHORTNAME'
``` ```
- COMMENTO:
```toml
[params] [params]
commentoEnable = true commentoEnable = true
``` ```
@ -334,6 +341,14 @@ Dates of blog posts and single pages are rendered with the default date format c
With hugo 0.87.0 and above, you can also use predefined layout, like `:date_full`, and it will output localized dates or times. With hugo 0.87.0 and above, you can also use predefined layout, like `:date_full`, and it will output localized dates or times.
See hugo's documentation of the [`time.Format` function](https://gohugo.io/functions/dateformat/) for more details. See hugo's documentation of the [`time.Format` function](https://gohugo.io/functions/dateformat/) for more details.
### Using a canonical url
When you want to publish content that is already published on a different site. You need to reference a canonical url of the original content.
By defining the `canonicalUrl` in the front matter definition the canonical url is set in the headers.
```
canonicalUrl: https://mydomain.com/path-to-the-oringinal-content/
```
### Nearly finished ### Nearly finished

49
i18n/cs.toml Normal file
View file

@ -0,0 +1,49 @@
[more]
other = "Více"
[allTitle]
other = "Všechny {{.Title }}"
[recentTitle]
other = "Nejnovější {{.Title }}"
[readMore]
other = "čti dále"
[by]
other = "Autor"
[whatsInThis]
other = "Co je v tomto {{ .Type }}"
[related]
other = "Related"
[yourName]
other = "Jméno"
[emailAddress]
other = "Emailová adresa"
[message]
other = "Zpráva"
[emailRequiredNote]
other = "Emailová adresa je požadována."
[send]
other = "Odeslat"
[taxonomyPageList]
other = "Stránky obsahující taxonomický termín “{{ .Title }}”"
[readingTime]
one = "Jedna minuta čtení"
other = "{{ .Count }} minut čtení"
[wordCount]
one = "Jedno slovo"
other = "{{ .Count }} slov"
[pageTitle]
other = "{{ .Name }} stránka"

View file

@ -26,13 +26,13 @@ other = "Ditt navn"
other = "E-postadresse" other = "E-postadresse"
[message] [message]
other = "beskjed" other = "Beskjed"
[emailRequiredNote] [emailRequiredNote]
other = "E-postadresse er påkrevd" other = "E-postadresse er påkrevd"
[send] [send]
other = "Sende" other = "Send"
[taxonomyPageList] [taxonomyPageList]
other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”" other = "Below you will find pages that utilize the taxonomy term “{{ .Title }}”"

View file

@ -16,6 +16,15 @@
{{ else }} {{ else }}
<meta name="robots" content="noindex, nofollow"> <meta name="robots" content="noindex, nofollow">
{{ end }} {{ end }}
{{ with .Params.author | default .Site.Params.author }}
<meta name="author" content = "
{{- if reflect.IsSlice . -}}
{{ delimit . ", " | plainify }}
{{- else -}}
{{ . | plainify }}
{{- end -}}
">
{{ end }}
{{ partial "site-style.html" . }} {{ partial "site-style.html" . }}
{{ partial "site-scripts.html" . }} {{ partial "site-scripts.html" . }}
@ -31,6 +40,12 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if .Params.canonicalUrl }}
<link rel="canonical" href="{{ .Params.canonicalUrl }}">
{{ else }}
<link rel="canonical" href="{{ .Permalink }}">
{{ end }}
{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}} {{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}}
{{- template "_internal/opengraph.html" . -}} {{- template "_internal/opengraph.html" . -}}
{{- template "_internal/schema.html" . -}} {{- template "_internal/schema.html" . -}}

View file

@ -7,12 +7,12 @@
{{ $section := .Site.GetPage "section" .Section }} {{ $section := .Site.GetPage "section" .Section }}
<article class="flex-l flex-wrap justify-between mw8 center ph3"> <article class="flex-l flex-wrap justify-between mw8 center ph3">
<header class="mt4 w-100"> <header class="mt4 w-100">
<aside class="instapaper_ignoref b helvetica tracked"> <aside class="instapaper_ignoref b helvetica tracked ttu">
{{/* {{/*
CurrentSection allows us to use the section title instead of inferring from the folder. CurrentSection allows us to use the section title instead of inferring from the folder.
https://gohugo.io/variables/page/#section-variables-and-methods https://gohugo.io/variables/page/#section-variables-and-methods
*/}} */}}
{{with .CurrentSection.Title }}{{. | upper }}{{end}} {{ .CurrentSection.Title }}
</aside> </aside>
{{ partial "social-share.html" . }} {{ partial "social-share.html" . }}
<h1 class="f1 athelas mt3 mb1"> <h1 class="f1 athelas mt3 mb1">
@ -51,7 +51,7 @@
{{- .Content -}} {{- .Content -}}
{{- partial "tags.html" . -}} {{- partial "tags.html" . -}}
<div class="mt6 instapaper_ignoref"> <div class="mt6 instapaper_ignoref">
{{ if .Site.DisqusShortname }} {{ if .Site.Config.Services.Disqus.Shortname }}
{{ template "_internal/disqus.html" . }} {{ template "_internal/disqus.html" . }}
{{ end }} {{ end }}
{{ if .Site.Params.commentoEnable }} {{ if .Site.Params.commentoEnable }}

View file

@ -9,5 +9,6 @@
<div class="nested-links f5 lh-copy nested-copy-line-height"> <div class="nested-links f5 lh-copy nested-copy-line-height">
{{ .Summary }} {{ .Summary }}
</div> </div>
<a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a>
</div> </div>
</div> </div>

View file

@ -4,17 +4,18 @@
</article> </article>
{{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}} {{/* Define a section to pull recent posts from. For Hugo 0.20 this will default to the section with the most number of pages. */}}
{{ $mainSections := .Site.Params.mainSections | default (slice "post") }} {{ $mainSections := .Site.Params.mainSections | default (slice "post") }}
{{/* Create a variable with that section to use in multiple places. */}}
{{ $section := where .Site.RegularPages "Section" "in" $mainSections }}
{{/* Check to see if the section is defined for ranging through it */}} {{/* Check to see if the section is defined for ranging through it */}}
{{range ($mainSections)}}
{{/* Derive the section name */}}
{{ $section_name := . }}
{{/* Create a variable with that section to use in multiple places. */}}
{{ $section := where $.Site.RegularPages "Section" "in" $section_name }}
{{ $section_count := len $section }} {{ $section_count := len $section }}
{{ if ge $section_count 1 }} {{ if ge $section_count 1 }}
{{/* Derive the section name */}}
{{ $section_name := index (.Site.Params.mainSections) 0 }}
<div class="pa3 pa4-ns w-100 w-70-ns center"> <div class="pa3 pa4-ns w-100 w-70-ns center">
{{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}} {{/* Use $section_name to get the section title. Use "with" to only show it if it exists */}}
{{ with .Site.GetPage "section" $section_name }} {{ with $.Site.GetPage "section" $section_name }}
<h1 class="flex-none"> <h1 class="flex-none">
{{ $.Param "recent_copy" | default (i18n "recentTitle" .) }} {{ $.Param "recent_copy" | default (i18n "recentTitle" .) }}
</h1> </h1>
@ -44,7 +45,7 @@
{{ end }} {{ end }}
{{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}} {{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
{{ with .Site.GetPage "section" $section_name }} {{ with $.Site.GetPage "section" $section_name }}
<a href="{{ .RelPermalink }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{ i18n "allTitle" . }}</a> <a href="{{ .RelPermalink }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{ i18n "allTitle" . }}</a>
{{ end }} {{ end }}
</section> </section>
@ -53,3 +54,5 @@
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{end}}

View file

@ -2,7 +2,7 @@
{{ $url := printf "%s" .Permalink | absLangURL }} {{ $url := printf "%s" .Permalink | absLangURL }}
{{ $facebook_href := printf "https://www.facebook.com/sharer.php?u=%s" $url }} {{ $facebook_href := printf "https://www.facebook.com/sharer.php?u=%s" $url }}
{{ $twitter_href := printf "https://twitter.com/share?url=%s&text=%s" $url $title }} {{ $twitter_href := printf "https://twitter.com/intent/tweet?url=%s&text=%s" $url $title }}
{{ with site.Social.twitter }} {{ with site.Social.twitter }}
{{ $twitter_href = printf "%s&via=%s" $twitter_href . }} {{ $twitter_href = printf "%s&via=%s" $twitter_href . }}
{{ end }} {{ end }}

View file

@ -12,4 +12,5 @@
<div class="nested-links f5 lh-copy nested-copy-line-height"> <div class="nested-links f5 lh-copy nested-copy-line-height">
{{ .Summary }} {{ .Summary }}
</div> </div>
<a href="{{.RelPermalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a>
</div> </div>