🔖 Release v2.0.2

pull/155/head v2.0.2
James Panther 2022-02-05 19:42:27 +11:00
commit 5380e024ec
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
10 changed files with 72 additions and 40 deletions

View File

@ -6,6 +6,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased] ## [Unreleased]
## [2.0.2] - 2022-02-05
### Changed
- Updated French translation ([#100](https://github.com/jpanther/congo/pull/100))
### Fixed
- User's appearance preference is lost on page load when default appearance is dark ([#102](https://github.com/jpanther/congo/issues/102))
- JavaScript warning when appearance switcher is disabled
## [2.0.1] - 2022-02-03 ## [2.0.1] - 2022-02-03
### Fixed ### Fixed
@ -38,7 +49,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- ⚠️ All theme images are now Hugo assets - ⚠️ All theme images are now Hugo assets
- ⚠️ Overhauled `figure` shortcode which now resizes images - ⚠️ Overhauled `figure` shortcode which now resizes images
- Upgrade to Tailwind v3.0.18 - Upgrade to Tailwind v3.0.18
- Inline Javascript moved to external files - Inline JavaScript moved to external files
- Improved JSON-LD structured data - Improved JSON-LD structured data
- Breadcrumbs now fallback to section name when `title` is not provided - Breadcrumbs now fallback to section name when `title` is not provided
- Minor style and layout improvements - Minor style and layout improvements
@ -288,7 +299,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Advanced customisation using simple Tailwind colour definitions and styles - Advanced customisation using simple Tailwind colour definitions and styles
- Fully documented - Fully documented
[unreleased]: https://github.com/jpanther/congo/compare/v2.0.1...HEAD [unreleased]: https://github.com/jpanther/congo/compare/v2.0.2...HEAD
[2.0.2]: https://github.com/jpanther/congo/compare/v2.0.1...v2.0.2
[2.0.1]: https://github.com/jpanther/congo/compare/v2.0.0...v2.0.1 [2.0.1]: https://github.com/jpanther/congo/compare/v2.0.0...v2.0.1
[2.0.0]: https://github.com/jpanther/congo/compare/v1.6.4...v2.0.0 [2.0.0]: https://github.com/jpanther/congo/compare/v1.6.4...v2.0.0
[1.6.4]: https://github.com/jpanther/congo/compare/v1.6.3...v1.6.4 [1.6.4]: https://github.com/jpanther/congo/compare/v1.6.3...v1.6.4

View File

@ -1,4 +1,4 @@
/*! Congo v2.0.1 | MIT License | https://github.com/jpanther/congo */ /*! Congo v2.0.2 | MIT License | https://github.com/jpanther/congo */
/*! tailwindcss v3.0.18 | MIT License | https://tailwindcss.com */ /*! tailwindcss v3.0.18 | MIT License | https://tailwindcss.com */

View File

@ -1,4 +1,4 @@
/*! Congo v2.0.1 | MIT License | https://github.com/jpanther/congo */ /*! Congo v2.0.2 | MIT License | https://github.com/jpanther/congo */
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;

View File

@ -1,11 +1,14 @@
const browserIsDark = const browserIsDark =
window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches; window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
const sitePreference = document.documentElement.getAttribute("data-default-appearance");
const userPreference = localStorage.getItem("appearance"); const userPreference = localStorage.getItem("appearance");
const switcher = document.getElementById("appearance-switcher"); const switcher = document.getElementById("appearance-switcher");
if ( if (
(browserIsDark && userPreference === null) || (browserIsDark && userPreference === null) ||
(browserIsDark && userPreference === "dark") || (browserIsDark && userPreference === "dark") ||
(sitePreference === "dark" && userPreference === null) ||
(sitePreference === "dark" && userPreference === "dark") ||
userPreference === "dark" userPreference === "dark"
) { ) {
document.documentElement.classList.add("dark"); document.documentElement.classList.add("dark");
@ -22,6 +25,7 @@ if (document.documentElement.getAttribute("data-auto-appearance") === "true") {
} }
window.addEventListener("DOMContentLoaded", (event) => { window.addEventListener("DOMContentLoaded", (event) => {
if (switcher) {
switcher.addEventListener("click", () => { switcher.addEventListener("click", () => {
document.documentElement.classList.toggle("dark"); document.documentElement.classList.toggle("dark");
localStorage.setItem( localStorage.setItem(
@ -33,4 +37,5 @@ window.addEventListener("DOMContentLoaded", (event) => {
event.preventDefault(); event.preventDefault();
localStorage.removeItem("appearance"); localStorage.removeItem("appearance");
}); });
}
}); });

View File

@ -89,6 +89,14 @@ The default file can be used as a template to create additional languages, or re
|`author.links`|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.| |`author.links`|_Not set_|The links to display alongside the author's details. The config file contains example links which can simply be uncommented to enable. The order that the links are displayed is determined by the order they appear in the array. Custom links can be added by providing corresponding SVG icon assets in `assets/icons/`.|
<!-- prettier-ignore-end --> <!-- prettier-ignore-end -->
### Menus
Congo also supports language-specific menu configurations. Menu config files follow the same naming format as the languages file. Simply provide the language code in the file name to tell Hugo which language the file relates to.
Menu config files are named with the format `menus.[language-code].toml`. Always ensure that the language code used in the menus configuration matches the languages configuration.
The [Getting Started]({{< ref "getting-started#menus" >}}) section explains more about the structure of this file. You can also refer to the [Hugo menu docs](https://gohugo.io/content-management/menus/) for more configuration examples.
## Theme parameters ## Theme parameters
Congo provides a large number of configuration parameters that control how the theme functions. The table below outlines every available parameter in the `config/_default/params.toml` file. Congo provides a large number of configuration parameters that control how the theme functions. The table below outlines every available parameter in the `config/_default/params.toml` file.

View File

@ -131,7 +131,7 @@ When you create a new taxonomy, you will need to adjust the navigation links on
Congo has two menus that can be customised to suit the content and layout of your site. The `main` menu appears in the site header and the `footer` menu appears at the bottom of the page just above the copyright notice. Congo has two menus that can be customised to suit the content and layout of your site. The `main` menu appears in the site header and the `footer` menu appears at the bottom of the page just above the copyright notice.
Both menus are configured in the `menus.toml` file. Both menus are configured in the `menus.en.toml` file. Similarly to the languages config file, if you wish to use another language, rename this file and replace `en` with the language code you wish to use.
```toml ```toml
# config/_default/menus.toml # config/_default/menus.toml

View File

@ -38,6 +38,8 @@ Then change into your project directory and execute the following command:
hugo mod get -u hugo mod get -u
``` ```
Note that in some circumstances there may be issues with this step due to the way that Hugo locally caches modules. If the command above doesn't work, try using `hugo mod clean` to clear out the local cache and re-download any modules.
Once the theme has been upgraded, continue to the [next section](#step-3-theme-configuration). Once the theme has been upgraded, continue to the [next section](#step-3-theme-configuration).
### Upgrade using git ### Upgrade using git
@ -45,7 +47,7 @@ Once the theme has been upgraded, continue to the [next section](#step-3-theme-c
Git submodules can be upgraded using the `git` command. Simply execute the following command and the latest version of the theme will be downloaded into your local repository: Git submodules can be upgraded using the `git` command. Simply execute the following command and the latest version of the theme will be downloaded into your local repository:
```shell ```shell
git submodule upgrade --remote --merge git submodule update --remote --merge
``` ```
Once the submodule has been upgraded, continue to the [next section](#step-3-theme-configuration). Once the submodule has been upgraded, continue to the [next section](#step-3-theme-configuration).
@ -107,6 +109,10 @@ Using your preferred language, simply create this new file in `config/_default/`
Once the values have been moved to the new location, these parameters should be deleted from their original locations. Once the values have been moved to the new location, these parameters should be deleted from their original locations.
### Menus.toml
As the theme is now aware of languages, the `menus.toml` file should also be renamed to include a language code. Rename the existing `menus.toml` to `menus.[lang-code].toml`, where the language code matches the code used in the `languages.toml` file in the previous section.
### Config.toml ### Config.toml
The `config.toml` file now only contains base Hugo configuration values. Other than removing the language-specific strings above, there are only two changes to consider. The `config.toml` file now only contains base Hugo configuration values. Other than removing the language-specific strings above, there are only two changes to consider.
@ -168,12 +174,14 @@ For the full list of supported parameters, refer to the [Configuration]({{< ref
## Step 4: Move assets ## Step 4: Move assets
All site assets now use Hugo Pipes to build an optimised version of your project. In order for the theme to locate your files, any previously static assets used in the theme need to be moved to the Hugo assets folder. All site assets, with the exception of favicons, now use Hugo Pipes to build an optimised version of your project. In order for the theme to locate your files, any previously static theme assets need to be moved to the Hugo assets folder. Primarily this is the author image and site logo:
`static/me.jpg` **&rarr;** `assets/me.jpg` `static/me.jpg` **&rarr;** `assets/me.jpg`
`static/logo.jpg` **&rarr;** `assets/logo.jpg` `static/logo.jpg` **&rarr;** `assets/logo.jpg`
If you have provided an author image or site logo, simply move these assets from the `static/` folder to the `assets/` folder. If you use the same directory structure the theme will know where to find these files automatically. If you would like to provide a new path, update the `logo` and `author.image` config values accordingly. If you have provided an author image or site logo, simply move these assets from `static/` to `assets/`. If you use the same directory structure the theme will know where to find these files automatically. If you would like to provide a new path, update the `logo` and `author.image` config values accordingly.
Note that this step does not apply to any assets in your project that are actually static. For example, a PDF file that you link directly to from within an article is a static asset. These files should remain in the `static/` directory to ensure they are copied to the output folder when Hugo builds the site.
## Step 5: Check content ## Step 5: Check content

View File

@ -1,24 +1,24 @@
article: article:
anchor_label: "Ancre" anchor_label: "Ancre"
date: "{{ .Date }}" date: "{{ .Date }}"
# date_updated: "Updated: {{ .Date }}" date_updated: "Mis à jour: {{ .Date }}"
draft: "Brouillon" draft: "Brouillon"
edit_title: "Editer" edit_title: "Editer"
reading_time: reading_time:
one: "{{ .Count }} min" one: "{{ .Count }} min"
other: "{{ .Count }} mins" other: "{{ .Count }} mins"
reading_time_title: "Temps de lecture" reading_time_title: "Temps de lecture"
# table_of_contents: "Table of Contents" table_of_contents: "Sommaire"
# word_count: word_count:
# one: "{{ .Count }} word" one: "{{ .Count }} mot"
# other: "{{ .Count }} words" other: "{{ .Count }} mots"
author: author:
byline_title: "Auteur" byline_title: "Auteur"
# code: code:
# copy: "Copy" copy: "Copier"
# copied: "Copied" copied: "Copié"
error: error:
404_title: "Cette page n'existe pas :confused:" 404_title: "Cette page n'existe pas :confused:"
@ -26,22 +26,22 @@ error:
404_description: "Il semble que la page que vous cherchiez n'existe pas." 404_description: "Il semble que la page que vous cherchiez n'existe pas."
footer: footer:
# dark_appearance: "Switch to dark appearance" dark_appearance: "Passer au thème sombre"
# light_appearance: "Switch to light appearance" light_appearance: "Passer au thème clair"
powered_by: "Propulsé par {{ .Hugo }} &amp; {{ .Congo }}" powered_by: "Propulsé par {{ .Hugo }} &amp; {{ .Congo }}"
list: list:
externalurl_title: "Lien d'article externe." externalurl_title: "Lien d'article externe."
no_articles: "Il n'y a pas encore d'articles ici." no_articles: "Il n'y a pas encore d'articles ici."
# nav: nav:
# scroll_to_top_title: "Scroll to top" scroll_to_top_title: "Faire défiler jusqu'au bas de la page"
# skip_to_main: "Skip to main content" skip_to_main: "Aller au contenu"
# search: search:
# open_button_title: "Search (/)" open_button_title: "Chercher (/)"
# close_button_title: "Close (Esc)" close_button_title: "Fermer (Esc)"
# input_placeholder: "Search" input_placeholder: "Chercher"
sharing: sharing:
email: "Envoyer par email" email: "Envoyer par email"

View File

@ -8,9 +8,8 @@
{{- else -}} {{- else -}}
ltr ltr
{{- end }}" {{- end }}"
class="scroll-smooth {{ if eq (.Site.Params.defaultAppearance | default "light") "dark" -}} class="scroll-smooth"
dark data-default-appearance="{{ .Site.Params.defaultAppearance | default "light" }}"
{{- end }}"
data-auto-appearance="{{ .Site.Params.autoSwitchAppearance | default "true" }}" data-auto-appearance="{{ .Site.Params.autoSwitchAppearance | default "true" }}"
> >
{{- partial "head.html" . -}} {{- partial "head.html" . -}}

View File

@ -1,6 +1,6 @@
{ {
"name": "hugo-congo-theme", "name": "hugo-congo-theme",
"version": "2.0.1", "version": "2.0.2",
"description": "Congo theme for Hugo", "description": "Congo theme for Hugo",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {