From 139706895c7751803499918800ba29de78f39410 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Wed, 18 Aug 2021 14:35:54 +1000 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Move=20homepage=20recent?= =?UTF-8?q?=20articles=20to=20partial?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 ++++++- config/_default/params.toml | 4 ++-- exampleSite/config.toml | 4 ++-- exampleSite/content/docs/configuration.md | 4 ++-- exampleSite/content/docs/homepage-layout/index.md | 4 +++- exampleSite/layouts/partials/home/custom.html | 2 +- i18n/en.yaml | 6 ++---- layouts/index.html | 8 -------- layouts/partials/home/page.html | 3 +++ layouts/partials/home/profile.html | 12 ++++++------ layouts/partials/recent-articles.html | 6 ++++++ layouts/shortcodes/icon.html | 2 +- static/css/main.css | 2 +- 13 files changed, 35 insertions(+), 29 deletions(-) create mode 100644 layouts/partials/recent-articles.html diff --git a/CHANGELOG.md b/CHANGELOG.md index f231c0fe..4bc4f69e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to Congo will be documented in this file. +Things that need attention when upgrading from a prior version are marked 🚨. + The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). --- @@ -12,11 +14,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - Breadcrumbs - i18n support +- Recent articles partial - CSS transitions ### Changed -- Consolidated author configuration parameters into `config.toml` +- 🚨 Renamed parameter: `homepage.showList` -> `homepage.showRecent` +- 🚨 Renamed parameter: `homepage.listSections` -> `homepage.mainSections` +- 🚨 Consolidated author configuration parameters into `config.toml` - General style tweaks to enhance design consistency ### Fixed diff --git a/config/_default/params.toml b/config/_default/params.toml index 1485d7fd..594f3a53 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -7,8 +7,8 @@ [homepage] layout = "page" # valid options: page, profile, custom - showList = false - listSections = ["blog"] + showRecent = false + # mainSections = ["section1", "section2"] [article] showDate = true diff --git a/exampleSite/config.toml b/exampleSite/config.toml index aaa6c652..857fd1cf 100755 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -30,8 +30,8 @@ relativeURLs = true [params.homepage] layout = "custom" - showList = true - listSections = "samples" + showRecent = true + mainSections = ["samples"] [params.list] groupByYear = false diff --git a/exampleSite/content/docs/configuration.md b/exampleSite/content/docs/configuration.md index 4871d82d..07976035 100644 --- a/exampleSite/content/docs/configuration.md +++ b/exampleSite/content/docs/configuration.md @@ -57,8 +57,8 @@ Many of the article defaults here can be overridden on a per article basis by sp |Name|Type|Default|Description| | --- | --- | --- | --- | |`homepage.layout`|string|`"page"`|The layout of the homepage. Valid values are `page`, `profile` or `custom`. When set to `custom`, you must provide your own layout by creating a `/layouts/partials/home/custom.html` file. Refer to the [Homepage Layout](/docs/homepage-layout/) section for more details.| -|`homepage.showList`|boolean|`false`|Whether or not recent articles are listed on the homepage beneath the page content. Refer to the [Recent Articles](/docs/homepage-layout/#recent-articles) docs for more details.| -|`homepage.listSections`|array of strings|`["blog"]`|The sections of content to include in the recent list when `homepage.showList` is `true`.| +|`homepage.showRecent`|boolean|`false`|Whether or not to display the recent articles list on the homepage.| +|`homepage.mainSections`|array of strings|_Not set_|The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used.| |`article.showDate`|boolean|`true`|Whether or not article dates are displayed.| |`article.dateFormat`|string|`"2 January 2006"`|How article dates are formatted. Refer to the [Hugo docs](https://gohugo.io/functions/format/#gos-layout-string) for acceptable formats.| |`article.showAuthor`|boolean|`true`|Whether or not the author box is displayed in the article footer.| diff --git a/exampleSite/content/docs/homepage-layout/index.md b/exampleSite/content/docs/homepage-layout/index.md index 7a54895c..0e84ca41 100644 --- a/exampleSite/content/docs/homepage-layout/index.md +++ b/exampleSite/content/docs/homepage-layout/index.md @@ -39,9 +39,11 @@ To enable the custom layout, set `homepage.layout = "custom"` in the `params.tom With the configuration value set, create a new `custom.html` file and place it in `layouts/partials/home/custom.html`. Now whatever is in the `custom.html` file will be placed in the content area of the site homepage. You can use whatever HTML, Tailwind, or Hugo templating functions to define your layout. +To include recent articles on the custom layout, use the `recent-articles.html` partial. + ## Recent articles -All homepage layouts have the option of displaying recent articles below the main page content. To enable this, simply set the `homepage.showList` setting to `true` in the `params.toml` configuration file. +All homepage layouts have the option of displaying recent articles below the main page content. To enable this, simply set the `homepage.showRecent` setting to `true` in the `params.toml` configuration file. ![Profile layout with recent articles](home-profile-list.jpg) diff --git a/exampleSite/layouts/partials/home/custom.html b/exampleSite/layouts/partials/home/custom.html index ea4f0452..b301686a 100644 --- a/exampleSite/layouts/partials/home/custom.html +++ b/exampleSite/layouts/partials/home/custom.html @@ -1,7 +1,7 @@
{{ partial "partials/home/page.html" . }}
-