From 66198da716cae440a1aed8fe4eadafad9b4df1d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Sat, 29 Apr 2023 15:56:55 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Related=20articles=20feature=20adde?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/css/compiled/main.css | 10 ++- assets/css/main.css | 9 ++- config/_default/config.toml | 30 ++++++++ config/_default/params.toml | 2 + exampleSite/assets/js/home.js | 2 +- exampleSite/config/_default/config.toml | 30 ++++++++ exampleSite/config/_default/menus.en.toml | 35 +++++---- exampleSite/config/_default/params.toml | 6 +- .../content/docs/configuration/index.md | 58 +++++++------- .../content/docs/hosting-deployment/index.md | 2 +- .../partials/recent-articles-demo.html | 10 +-- ...3d8d209a6_5000159_600x0_resize_q75_box.jpg | Bin 0 -> 87173 bytes ...bfc95943591_1864112_600x0_resize_box_3.png | Bin 0 -> 605077 bytes i18n/bg.yaml | 2 + i18n/bn.yaml | 1 + i18n/cs.yaml | 1 + i18n/de.yaml | 1 + i18n/en.yaml | 1 + i18n/es.yaml | 1 + i18n/fi.yaml | 1 + i18n/fr.yaml | 1 + i18n/he.yaml | 1 + i18n/hr.yaml | 1 + i18n/hu.yaml | 1 + i18n/id.yaml | 1 + i18n/it.yaml | 1 + i18n/ja.yaml | 1 + i18n/pl.yaml | 1 + i18n/pt-BR.yaml | 1 + i18n/pt-PT.yaml | 1 + i18n/ro.yaml | 1 + i18n/ru.yaml | 1 + i18n/tr.yaml | 1 + i18n/vi.yaml | 1 + i18n/zh-CN.yaml | 1 + i18n/zh-TW.yaml | 1 + layouts/_default/list.html | 16 ++-- layouts/_default/single.html | 38 +++++---- .../partials/article-link/card-related.html | 72 ++++++++++++++++++ layouts/partials/related.html | 11 +++ 40 files changed, 274 insertions(+), 81 deletions(-) create mode 100644 exampleSite/resources/_gen/images/iceland_hu3d03a01dcc18bc5be0e67db3d8d209a6_5000159_600x0_resize_q75_box.jpg create mode 100644 exampleSite/resources/_gen/images/paint_hu507bbb0ec7aba0818718abfc95943591_1864112_600x0_resize_box_3.png create mode 100644 layouts/partials/article-link/card-related.html create mode 100644 layouts/partials/related.html diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 2e74f439..c573073e 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -2874,7 +2874,6 @@ select { .to-transparent { --tw-gradient-to: transparent var(--tw-gradient-to-position); - --tw-gradient-to-position: ; } .bg-clip-padding { @@ -4485,7 +4484,14 @@ body:has(#menu-controller:checked) { } .thumbnail_card { - height: 250px; + height: 200px; + background-repeat:no-repeat; + background-size:cover; + background-position:center; +} + +.thumbnail_card_related { + height: 150px; background-repeat:no-repeat; background-size:cover; background-position:center; diff --git a/assets/css/main.css b/assets/css/main.css index 5ac7bb23..bc69caeb 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -348,7 +348,14 @@ body:has(#menu-controller:checked) { } .thumbnail_card { - height: 250px; + height: 200px; + background-repeat:no-repeat; + background-size:cover; + background-position:center; +} + +.thumbnail_card_related { + height: 150px; background-repeat:no-repeat; background-size:cover; background-position:center; diff --git a/config/_default/config.toml b/config/_default/config.toml index 755fd4fe..632d7650 100644 --- a/config/_default/config.toml +++ b/config/_default/config.toml @@ -33,3 +33,33 @@ buildFuture = false [outputs] home = ["HTML", "RSS", "JSON"] + +[related] + threshold = 0 + toLower = false + + [[related.indices]] + name = "tags" + weight = 100 + + [[related.indices]] + name = "categories" + weight = 100 + + [[related.indices]] + name = "series" + weight = 50 + + [[related.indices]] + name = "authors" + weight = 20 + + [[related.indices]] + name = "date" + weight = 10 + + [[related.indices]] + applyFilter = false + name = 'fragmentrefs' + type = 'fragments' + weight = 10 diff --git a/config/_default/params.toml b/config/_default/params.toml index 1e4b3e98..fad98102 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -66,6 +66,8 @@ disableImageOptimization = false invertPagination = false showReadingTime = true showTableOfContents = false + # showRelatedContent = false + # relatedContentLimit = 3 showTaxonomies = false showAuthorsBadges = false showWordCount = true diff --git a/exampleSite/assets/js/home.js b/exampleSite/assets/js/home.js index a267286c..fc8e5583 100644 --- a/exampleSite/assets/js/home.js +++ b/exampleSite/assets/js/home.js @@ -35,8 +35,8 @@ window.addEventListener("DOMContentLoaded", (event) => { }); var list_config = [ - "CardViewScreenWidth", "CardViewProse", + "CardViewScreenWidth", "NormalView" ] diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml index 668d0d88..2046ac89 100644 --- a/exampleSite/config/_default/config.toml +++ b/exampleSite/config/_default/config.toml @@ -33,3 +33,33 @@ googleAnalytics = "G-PEDMYR1V0K" [outputs] home = ["HTML", "RSS", "JSON"] + +[related] + threshold = 0 + toLower = false + + [[related.indices]] + name = "tags" + weight = 100 + + [[related.indices]] + name = "categories" + weight = 100 + + [[related.indices]] + name = "series" + weight = 50 + + [[related.indices]] + name = "authors" + weight = 20 + + [[related.indices]] + name = "date" + weight = 10 + + [[related.indices]] + applyFilter = false + name = 'fragmentrefs' + type = 'fragments' + weight = 10 diff --git a/exampleSite/config/_default/menus.en.toml b/exampleSite/config/_default/menus.en.toml index d1e317b9..c8df8eb0 100644 --- a/exampleSite/config/_default/menus.en.toml +++ b/exampleSite/config/_default/menus.en.toml @@ -15,37 +15,36 @@ pageRef = "docs" weight = 10 -[[main]] - name = "Examples" - weight = 20 +#[[main]] +# name = "Examples" +# weight = 20 + -[[main]] - name = "Recipes" - parent = "Examples" - pageRef = "guides" - weight = 10 [[main]] name = "Samples" - parent = "Examples" pageRef = "samples" weight = 20 [[main]] name = "Showcase" - parent = "Examples" pageRef = "examples" weight = 30 [[main]] - name = "Users" - pageRef = "users" + name = "Recipes" + pageRef = "guides" weight = 40 [[main]] - name = "Merch" - url = "http://tee.pub/lic/qwSlWVBL5zc" - weight = 50 + name = "Users" + pageRef = "users" + weight = 90 + +#[[main]] +# name = "Merch" +# url = "http://tee.pub/lic/qwSlWVBL5zc" +# weight = 100 #[[main]] # name = "Test" @@ -56,19 +55,19 @@ identifier = "twitter" pre = "twitter" url = "https://twitter.com/burufugu" - weight = 60 + weight = 200 [[main]] identifier = "mastodon" pre = "mastodon" url = "https://masto.ai/@blowfish" - weight = 70 + weight = 300 [[main]] identifier = "github" pre = "github" url = "https://github.com/nunocoracao/blowfish" - weight = 80 + weight = 400 # -- Footer Menu -- diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml index 836732b5..6a1dbcc4 100644 --- a/exampleSite/config/_default/params.toml +++ b/exampleSite/config/_default/params.toml @@ -18,7 +18,7 @@ mainSections = ["docs"] disableImageOptimization = false defaultBackgroundImage = "/img/bg.jpg" -#defaultFeaturedImage = "/img/blowfish_logo.png" +defaultFeaturedImage = "/img/paint.png" highlightCurrentMenuArea = true smartTOC = true @@ -38,7 +38,7 @@ smartTOCHideUnfocusedChildren = true layout = "custom" # valid options: page, profile, hero, card, background, custom # homepageImage = "/img/iceland.jpg" # used in: hero, and card showRecent = false - showRecentItems = 10 + showRecentItems = 6 showMoreLink = true showMoreLinkDest = "docs" cardView = false @@ -65,6 +65,8 @@ smartTOCHideUnfocusedChildren = true invertPagination = false showReadingTime = true showTableOfContents = true + showRelatedContent = true + relatedContentLimit = 6 showTaxonomies = true showAuthorsBadges = true showWordCount = false diff --git a/exampleSite/content/docs/configuration/index.md b/exampleSite/content/docs/configuration/index.md index 085674ff..69066178 100644 --- a/exampleSite/content/docs/configuration/index.md +++ b/exampleSite/content/docs/configuration/index.md @@ -181,34 +181,36 @@ Many of the article defaults here can be overridden on a per article basis by sp | `homepage.layoutBackgroundBlur` | `false` | Makes the background image in the homepage layout blur with the scroll | ### Article -| Name | Default | Description | -| ------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `article.showDate` | `true` | Whether or not article dates are displayed. | -| `article.showViews` | `false` | Whether or not article views are displayed. This requires firebase integrations to be enabled, look below. | -| `article.showLikes` | `false` | Whether or not article likes are displayed. This requires firebase integrations to be enabled, look below. | -| `article.showDateUpdated` | `false` | Whether or not the dates articles were updated are displayed. | -| `article.showAuthor` | `true` | Whether or not the author box is displayed in the article footer. | -| `article.showHero` | `false` | Whether the thumbnail image will be shown as a hero image within each article page. | -| `article.heroStyle` | _Not set_ | Style to display the hero image, valid options are: `basic`, `big`, `background`, `thumbAndBackground`. | -| `article.layoutBackgroundBlur` | `true` | Makes the background image in the background article heroStyle blur with the scroll | -| `article.layoutBackgroundHeaderSpace` | `true` | Add space between the header and the body. | -| `article.showBreadcrumbs` | `false` | Whether or not breadcrumbs are displayed in the article header. | -| `article.showDraftLabel` | `true` | Whether or not the draft indicator is shown next to articles when site is built with `--buildDrafts`. | -| `article.showEdit` | `false` | Whether or not the link to edit the article content should be displayed. | -| `article.editURL` | _Not set_ | When `article.showEdit` is active, the URL for the edit link. | -| `article.editAppendPath` | `true` | When `article.showEdit` is active, whether or not the path to the current article should be appended to the URL set at `article.editURL`. | -| `article.seriesOpened` | `false` | Whether or not the series module will be displayed open by default or not. | -| `article.showHeadingAnchors` | `true` | Whether or not heading anchor links are displayed alongside headings within articles. | -| `article.showPagination` | `true` | Whether or not the next/previous article links are displayed in the article footer. | -| `article.invertPagination` | `false` | Whether or not to flip the direction of the next/previous article links. | -| `article.showReadingTime` | `true` | Whether or not article reading times are displayed. | -| `article.showTableOfContents` | `false` | Whether or not the table of contents is displayed on articles. | -| `article.showTaxonomies` | `false` | Whether or not the taxonomies related to this article are displayed. | -| `article.showAuthorsBadges` | `false` | Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature. | -| `article.showWordCount` | `false` | Whether or not article word counts are displayed. | -| `article.showComments` | `false` | Whether or not the [comments partial]({{< ref "partials#comments" >}}) is included after the article footer. | -| `article.showSummary` | `false` | Whether or not article summaries are displayed on list pages. If a summary is not provided in the [front matter]({{< ref "front-matter" >}}), one will be auto generated using the `summaryLength` parameter in the [site configuration](#site-configuration). | -| `article.sharingLinks` | _Not set_ | Which sharing links to display at the end of each article. When not provided, or set to `false` no links will be displayed. Available values are: "linkedin", "twitter", "reddit", "pinterest", "facebook", "email", "whatsapp", and "telegram" | +| Name | Default | Description | +| ------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `article.showDate` | `true` | Whether or not article dates are displayed. | +| `article.showViews` | `false` | Whether or not article views are displayed. This requires firebase integrations to be enabled, look below. | +| `article.showLikes` | `false` | Whether or not article likes are displayed. This requires firebase integrations to be enabled, look below. | +| `article.showDateUpdated` | `false` | Whether or not the dates articles were updated are displayed. | +| `article.showAuthor` | `true` | Whether or not the author box is displayed in the article footer. | +| `article.showHero` | `false` | Whether the thumbnail image will be shown as a hero image within each article page. | +| `article.heroStyle` | _Not set_ | Style to display the hero image, valid options are: `basic`, `big`, `background`, `thumbAndBackground`. | +| `article.layoutBackgroundBlur` | `true` | Makes the background image in the background article heroStyle blur with the scroll | +| `article.layoutBackgroundHeaderSpace` | `true` | Add space between the header and the body. | +| `article.showBreadcrumbs` | `false` | Whether or not breadcrumbs are displayed in the article header. | +| `article.showDraftLabel` | `true` | Whether or not the draft indicator is shown next to articles when site is built with `--buildDrafts`. | +| `article.showEdit` | `false` | Whether or not the link to edit the article content should be displayed. | +| `article.editURL` | _Not set_ | When `article.showEdit` is active, the URL for the edit link. | +| `article.editAppendPath` | `true` | When `article.showEdit` is active, whether or not the path to the current article should be appended to the URL set at `article.editURL`. | +| `article.seriesOpened` | `false` | Whether or not the series module will be displayed open by default or not. | +| `article.showHeadingAnchors` | `true` | Whether or not heading anchor links are displayed alongside headings within articles. | +| `article.showPagination` | `true` | Whether or not the next/previous article links are displayed in the article footer. | +| `article.invertPagination` | `false` | Whether or not to flip the direction of the next/previous article links. | +| `article.showReadingTime` | `true` | Whether or not article reading times are displayed. | +| `article.showTableOfContents` | `false` | Whether or not the table of contents is displayed on articles. | +| `article.showRelatedContent` | `false` | Display related content for each post. Might required additional configuration to your `config.toml`. Please check the theme `config.toml` if you want to enable this feature and copy all the relevant *related* entries. Also check [Hugo's docs](https://gohugo.io/content-management/related/) on related content. | +| `article.relatedContentLimit` | `3` | Limit of related articles to display if ` showRelatedContent` is turned on. | +| `article.showTaxonomies` | `false` | Whether or not the taxonomies related to this article are displayed. | +| `article.showAuthorsBadges` | `false` | Whether the `authors` taxonomies are are displayed in the article or list header. This requires the setup of `multiple authors` and the `authors` taxonomy. Check [this page]({{< ref "multi-author" >}}) for more details on how to configure that feature. | +| `article.showWordCount` | `false` | Whether or not article word counts are displayed. | +| `article.showComments` | `false` | Whether or not the [comments partial]({{< ref "partials#comments" >}}) is included after the article footer. | +| `article.showSummary` | `false` | Whether or not article summaries are displayed on list pages. If a summary is not provided in the [front matter]({{< ref "front-matter" >}}), one will be auto generated using the `summaryLength` parameter in the [site configuration](#site-configuration). | +| `article.sharingLinks` | _Not set_ | Which sharing links to display at the end of each article. When not provided, or set to `false` no links will be displayed. Available values are: "linkedin", "twitter", "reddit", "pinterest", "facebook", "email", "whatsapp", and "telegram" | ### List diff --git a/exampleSite/content/docs/hosting-deployment/index.md b/exampleSite/content/docs/hosting-deployment/index.md index 0231c410..8caa2e27 100644 --- a/exampleSite/content/docs/hosting-deployment/index.md +++ b/exampleSite/content/docs/hosting-deployment/index.md @@ -4,7 +4,7 @@ date: 2020-08-07 draft: false description: "Learn how to deploy a Blowfish site." slug: "hosting-deployment" -tags: ["hosting", "deployment", "docs", "github", "netlify", "render"] +tags: ["docs", "hosting", "deployment", "github", "netlify", "render"] series: ["Documentation"] series_order: 14 --- diff --git a/exampleSite/layouts/partials/recent-articles-demo.html b/exampleSite/layouts/partials/recent-articles-demo.html index 495cf779..d3660166 100644 --- a/exampleSite/layouts/partials/recent-articles-demo.html +++ b/exampleSite/layouts/partials/recent-articles-demo.html @@ -9,7 +9,7 @@
This is a demo of theme's list configurations: card view with full width + id="config">card view
-
- {{ partial "recent-articles/cardview-fullwidth.html" . }} +
+ {{ partial "recent-articles/cardview.html" . }}
-