From df1e688606ab989edf68753eab8203cd4146ae02 Mon Sep 17 00:00:00 2001 From: Igor Baiborodine Date: Wed, 1 Feb 2023 07:21:36 -0500 Subject: [PATCH] Issue-482: Fix for archive page displayed in latest post section (#483) --- exampleSite/config.toml | 12 ++++---- exampleSite/content/archive.de.md | 5 ++++ exampleSite/content/archive.md | 2 +- layouts/archive/single.html | 8 +++-- layouts/partials/footer.html | 7 ++--- testing/testing-example-site/config.toml | 6 ++++ .../content/archive.de.md | 5 ++++ .../testing-example-site/content/archive.md | 5 ++++ testing/testing-example-site/test-theme.sh | 29 ++++++++++++++++++- 9 files changed, 65 insertions(+), 14 deletions(-) create mode 100644 exampleSite/content/archive.de.md create mode 100644 testing/testing-example-site/content/archive.de.md create mode 100644 testing/testing-example-site/content/archive.md diff --git a/exampleSite/config.toml b/exampleSite/config.toml index e9eb6c677..2b5150ba8 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -138,12 +138,6 @@ disqusShortname = "" # social media profile urls for the footer links showSocialMedia = true - # show an archive link in the footer - showArchive = false - - # archive grouping: "2006" by year, "2006-01" by month - archiveDateGrouping = "2006-01" - # define your links with FontAwesome 5 (only free icons are supported) # all icons https://fontawesome.com/icons?d=gallery&m=free # brand icons https://fontawesome.com/icons?d=gallery&s=brands&m=free @@ -152,6 +146,12 @@ disqusShortname = "" { link = "https://github.com/Lednerb", icon = "fab fa-github" }, ] + # show an archive link in the footer + showArchive = false + + # archive grouping: "2006" by year, "2006-01" by month + archiveDateGrouping = "2006-01" + # credits line configuration copyrightBy = "by Lednerb" copyrightUseCurrentYear = true # set to true to always display the current year in the copyright diff --git a/exampleSite/content/archive.de.md b/exampleSite/content/archive.de.md new file mode 100644 index 000000000..f47320892 --- /dev/null +++ b/exampleSite/content/archive.de.md @@ -0,0 +1,5 @@ +--- +title: "Archivseite" +type: archive +excludeFromIndex: true +--- diff --git a/exampleSite/content/archive.md b/exampleSite/content/archive.md index a312690bc..4e3531029 100644 --- a/exampleSite/content/archive.md +++ b/exampleSite/content/archive.md @@ -1,5 +1,5 @@ --- -title: "Archive page" +title: "Archive Page" type: archive excludeFromIndex: true --- diff --git a/layouts/archive/single.html b/layouts/archive/single.html index ea0363e3d..6f556b3f9 100644 --- a/layouts/archive/single.html +++ b/layouts/archive/single.html @@ -1,13 +1,17 @@ {{ define "main" }}
- + {{ with .Site.GetPage "/archive" }} + + {{ end }}
-

{{ i18n "archive" }}

+ {{ with .Site.GetPage "/archive" }} +

{{ .Title }}

+ {{ end }}
{{ range (where .Site.RegularPages "Type" "not in" (slice "page" "archive" "status" ) ).GroupByPublishDate (.Site.Params.archiveDateGrouping | default "2006-01") }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 696c78b4d..8c4232d67 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -6,7 +6,7 @@
{{ i18n "latestPosts" }}
    - {{ $dontRender := (slice "page" "quote" "link" "status") }} + {{ $dontRender := (slice "page" "quote" "link" "status" "archive") }} {{ range (first (.Site.Params.amountLatestPostsInFooter | default 7) (where (where .Site.Pages.ByPublishDate.Reverse ".Kind" "page") ".Type" "not in" $dontRender )) }}
  • {{ .Title }} @@ -19,7 +19,7 @@ {{ if and .Site.Taxonomies.categories (gt ( .Site.Params.amountCategoriesInFooter | default 7 ) 0 ) }}
    {{ with .Site.GetPage "/categories" }} - {{ .Title }} + {{ i18n "categories" }} {{ end }}
      @@ -38,7 +38,6 @@ {{ if .Site.Params.showSocialMedia | default true }}
      {{ i18n "socialMedia" }} - {{ range .Site.Params.socialMediaLinks }} {{ end }} @@ -62,7 +61,7 @@ {{ if .Site.Params.showArchive | default true }}
      {{ with .Site.GetPage "/archive" }} - {{ .Title }} + {{ i18n "archive" }} {{ end }}
      {{ end }} diff --git a/testing/testing-example-site/config.toml b/testing/testing-example-site/config.toml index 40753d06a..5a497ab40 100644 --- a/testing/testing-example-site/config.toml +++ b/testing/testing-example-site/config.toml @@ -119,6 +119,12 @@ disqusShortname = "bilberry-hugo-theme" { link = "https://github.com/Lednerb", icon = "fab fa-github" }, ] + # show an archive link in the footer + showArchive = true + + # archive grouping: "2006" by year, "2006-01" by month + archiveDateGrouping = "2006-01" + # credits line configuration copyrightBy = "by Lednerb" copyrightUseCurrentYear = false # set to true to always display the current year in the copyright diff --git a/testing/testing-example-site/content/archive.de.md b/testing/testing-example-site/content/archive.de.md new file mode 100644 index 000000000..f47320892 --- /dev/null +++ b/testing/testing-example-site/content/archive.de.md @@ -0,0 +1,5 @@ +--- +title: "Archivseite" +type: archive +excludeFromIndex: true +--- diff --git a/testing/testing-example-site/content/archive.md b/testing/testing-example-site/content/archive.md new file mode 100644 index 000000000..4e3531029 --- /dev/null +++ b/testing/testing-example-site/content/archive.md @@ -0,0 +1,5 @@ +--- +title: "Archive Page" +type: archive +excludeFromIndex: true +--- diff --git a/testing/testing-example-site/test-theme.sh b/testing/testing-example-site/test-theme.sh index 3accf2162..0c7a5e675 100755 --- a/testing/testing-example-site/test-theme.sh +++ b/testing/testing-example-site/test-theme.sh @@ -86,6 +86,9 @@ testFolderAndContinue "$TARGET_DIR/de/tags/c++" testFolderAndContinue "$TARGET_DIR/tags/tästing++" testFolderAndContinue "$TARGET_DIR/de/tags/tästing++" +testFolderAndContinue "$TARGET_DIR/archive" +testFolderAndContinue "$TARGET_DIR/de/archive" + # article/täst [en] echo "## Testing article/täst [en]" testContentAndContinue 'Täst++' "$TARGET_DIR/article/täst/index.html" @@ -96,7 +99,7 @@ testContentAndContinue 'deUmlauts Täst++' "$TARGET_DIR/article/täst/index.html" testContentAndContinue '

      This is a umlauts-test in Quotes äüöß++

      ' "$TARGET_DIR/quote/index.html" testContentAndContinue 'Täst++ (2)' "$TARGET_DIR/article/täst/index.html" - +testContentAndContinue 'Archive' "$TARGET_DIR/article/täst/index.html" # article/täst [de] echo "## Testing article/täst [de]" testContentAndContinue 'Täst++' "$TARGET_DIR/de/article/täst/index.html" @@ -107,6 +110,7 @@ testContentAndContinue 'en' testContentAndContinue 'de Umlauts Täst++' "$TARGET_DIR/de/article/täst/index.html" testContentAndContinue '

      de This is a umlauts-test in quotes äüöß++

      ' "$TARGET_DIR/de/quote/index.html" testContentAndContinue 'Täst++ (2)' "$TARGET_DIR/de/article/täst/index.html" +testContentAndContinue 'Archiv' "$TARGET_DIR/de/article/täst/index.html" # quote/täst-quote [en] echo "## Testing quote/täst-quote [en]" @@ -120,6 +124,29 @@ testContentAndContinue ' ä ß+ ' "$TARGET_DIR/de/quote/täst-quote/index.html" +# archive [en] +echo "## Testing archive [en]" +testContentAndContinue '' "$TARGET_DIR/archive/index.html" +testContentAndContinue '

      Archive Page

      ' "$TARGET_DIR/archive/index.html" +testContentAndContinue '

      2020-05

      ' "$TARGET_DIR/archive/index.html" +testContentAndContinue '
      long text (2020-05-15)' "$TARGET_DIR/archive/index.html" +testContentAndContinue '

      2020-04

      ' "$TARGET_DIR/archive/index.html" +testContentAndContinue 'long text 1 (2020-04-15)' "$TARGET_DIR/archive/index.html" +testContentAndContinue '

      2020-03

      ' "$TARGET_DIR/archive/index.html" +testContentAndContinue 'long text manual readmore (2020-03-15)' "$TARGET_DIR/archive/index.html" +testContentAndContinue '

      2020-02

      ' "$TARGET_DIR/archive/index.html" +testContentAndContinue 'long text (2020-02-15)' "$TARGET_DIR/archive/index.html" +testContentAndContinue '

      2020-01

      ' "$TARGET_DIR/archive/index.html" +testContentAndContinue 'Umlauts Täst++ (2020-01-15)' "$TARGET_DIR/archive/index.html" +testContentAndContinue 'Quote Umlauts Täst++ (2020-01-14)' "$TARGET_DIR/archive/index.html" + +# archive [de] +echo "## Testing archive [de]" +testContentAndContinue '' "$TARGET_DIR/de/archive/index.html" +testContentAndContinue '

      Archivseite

      ' "$TARGET_DIR/de/archive/index.html" +testContentAndContinue '

      2020-01

      ' "$TARGET_DIR/de/archive/index.html" +testContentAndContinue '
      de Umlauts Täst++ (2020-01-15)' "$TARGET_DIR/de/archive/index.html" +testContentAndContinue 'de Quote Umlauts Täst++ (2020-01-14)' "$TARGET_DIR/de/archive/index.html" echo "# Build stability test"