mirror of https://github.com/jpanther/congo.git
♻️ Move homepage recent articles to partial
parent
7030022620
commit
139706895c
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
All notable changes to Congo will be documented in this file.
|
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).
|
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
|
- Breadcrumbs
|
||||||
- i18n support
|
- i18n support
|
||||||
|
- Recent articles partial
|
||||||
- CSS transitions
|
- CSS transitions
|
||||||
|
|
||||||
### Changed
|
### 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
|
- General style tweaks to enhance design consistency
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
|
|
||||||
[homepage]
|
[homepage]
|
||||||
layout = "page" # valid options: page, profile, custom
|
layout = "page" # valid options: page, profile, custom
|
||||||
showList = false
|
showRecent = false
|
||||||
listSections = ["blog"]
|
# mainSections = ["section1", "section2"]
|
||||||
|
|
||||||
[article]
|
[article]
|
||||||
showDate = true
|
showDate = true
|
||||||
|
|
|
@ -30,8 +30,8 @@ relativeURLs = true
|
||||||
|
|
||||||
[params.homepage]
|
[params.homepage]
|
||||||
layout = "custom"
|
layout = "custom"
|
||||||
showList = true
|
showRecent = true
|
||||||
listSections = "samples"
|
mainSections = ["samples"]
|
||||||
|
|
||||||
[params.list]
|
[params.list]
|
||||||
groupByYear = false
|
groupByYear = false
|
||||||
|
|
|
@ -57,8 +57,8 @@ Many of the article defaults here can be overridden on a per article basis by sp
|
||||||
|Name|Type|Default|Description|
|
|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.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.showRecent`|boolean|`false`|Whether or not to display the recent articles list on the homepage.|
|
||||||
|`homepage.listSections`|array of strings|`["blog"]`|The sections of content to include in the recent list when `homepage.showList` is `true`.|
|
|`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.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.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.|
|
|`article.showAuthor`|boolean|`true`|Whether or not the author box is displayed in the article footer.|
|
||||||
|
|
|
@ -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.
|
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
|
## 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)
|
![Profile layout with recent articles](home-profile-list.jpg)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<div id="page">
|
<div id="page">
|
||||||
{{ partial "partials/home/page.html" . }}
|
{{ partial "partials/home/page.html" . }}
|
||||||
</div>
|
</div>
|
||||||
<div id="profile" class="hidden">
|
<div id="profile" class="hidden h-full">
|
||||||
{{ partial "partials/home/profile.html" . }}
|
{{ partial "partials/home/profile.html" . }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,6 @@ error:
|
||||||
footer:
|
footer:
|
||||||
powered_by: "Powered by"
|
powered_by: "Powered by"
|
||||||
|
|
||||||
homepage:
|
|
||||||
recent: "Recent"
|
|
||||||
|
|
||||||
list:
|
list:
|
||||||
externalurl_title: "Link to external site"
|
externalurl_title: "Link to external site"
|
||||||
no_articles: "There's no articles to list here yet."
|
no_articles: "There's no articles to list here yet."
|
||||||
|
@ -32,4 +29,5 @@ sharing:
|
||||||
twitter: "Tweet on Twitter"
|
twitter: "Tweet on Twitter"
|
||||||
|
|
||||||
shortcode:
|
shortcode:
|
||||||
no_icon: "Icon not found."
|
recent_articles: "Recent"
|
||||||
|
icon_none: "Icon not found."
|
||||||
|
|
|
@ -5,12 +5,4 @@
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ partial "partials/home/page.html" . }}
|
{{ partial "partials/home/page.html" . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if .Site.Params.homepage.showList | default false }}
|
|
||||||
<section>
|
|
||||||
<h2 class="text-2xl font-extrabold">{{ i18n "homepage.recent" | emojify }}</h2>
|
|
||||||
{{ range first 5 (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.homepage.listSections)).Pages }}
|
|
||||||
{{ partial "article-link.html" . }}
|
|
||||||
{{ end }}
|
|
||||||
</section>
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -6,3 +6,6 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<section>{{ .Content | emojify }}</section>
|
<section>{{ .Content | emojify }}</section>
|
||||||
</article>
|
</article>
|
||||||
|
<section>
|
||||||
|
{{ partial "recent-articles.html" . }}
|
||||||
|
</section>
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
<article
|
<article
|
||||||
class="flex flex-col items-center justify-center text-center
|
class="flex flex-col items-center justify-center text-center {{ if not .Site.Params.homepage.showRecent }}
|
||||||
{{ if not .Site.Params.homepage.showList -}}
|
|
||||||
h-full
|
h-full
|
||||||
{{- else -}}
|
{{ end }}"
|
||||||
mb-8
|
|
||||||
{{- end }}"
|
|
||||||
>
|
>
|
||||||
<header class="flex flex-col items-center mb-3">
|
<header class="flex flex-col mb-3">
|
||||||
{{ with .Site.Author.image }}
|
{{ with .Site.Author.image }}
|
||||||
<img class="mb-2 rounded-full w-36 h-36" src="{{ . | absURL }}" />
|
<img class="mb-2 rounded-full w-36 h-36" src="{{ . | absURL }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -19,3 +16,6 @@
|
||||||
</header>
|
</header>
|
||||||
<section class="prose dark:prose-light">{{ .Content | emojify }}</section>
|
<section class="prose dark:prose-light">{{ .Content | emojify }}</section>
|
||||||
</article>
|
</article>
|
||||||
|
<section class="text-center">
|
||||||
|
{{ partial "recent-articles.html" . }}
|
||||||
|
</section>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{{ if .Site.Params.homepage.showRecent | default false }}
|
||||||
|
<h2 class="mt-8 text-2xl font-extrabold">{{ i18n "shortcode.recent_articles" | emojify }}</h2>
|
||||||
|
{{ range first 5 (.Paginate (where .Site.RegularPages "Type" "in" .Site.Params.homepage.mainSections)).Pages }}
|
||||||
|
{{ partial "article-link.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
|
@ -3,6 +3,6 @@
|
||||||
{{ if $icon }}
|
{{ if $icon }}
|
||||||
{{ $icon.Content | safeHTML }}
|
{{ $icon.Content | safeHTML }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<em>{{ i18n "shortcode.no_icon" }}</em>
|
<em>{{ i18n "shortcode.icon_none" }}</em>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</span>
|
</span>
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue