From 7d2dd5b548e1075a714baa0566ef15b4b3840a74 Mon Sep 17 00:00:00 2001 From: slashformotion Date: Thu, 3 Feb 2022 16:55:54 +0100 Subject: [PATCH 1/5] :globe_with_meridians: updated french translations --- i18n/fr.yaml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/i18n/fr.yaml b/i18n/fr.yaml index 4c1e73e8..ef3aa107 100644 --- a/i18n/fr.yaml +++ b/i18n/fr.yaml @@ -1,24 +1,24 @@ article: anchor_label: "Ancre" date: "{{ .Date }}" - # date_updated: "Updated: {{ .Date }}" + date_updated: "Mis à jour: {{ .Date }}" draft: "Brouillon" edit_title: "Editer" reading_time: one: "{{ .Count }} min" other: "{{ .Count }} mins" reading_time_title: "Temps de lecture" - # table_of_contents: "Table of Contents" - # word_count: - # one: "{{ .Count }} word" - # other: "{{ .Count }} words" + table_of_contents: "Sommaire" + word_count: + one: "{{ .Count }} mot" + other: "{{ .Count }} mots" author: byline_title: "Auteur" -# code: -# copy: "Copy" -# copied: "Copied" +code: + copy: "Copier" + copied: "Copié" error: 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." footer: - # dark_appearance: "Switch to dark appearance" - # light_appearance: "Switch to light appearance" + dark_appearance: "Passer au thème sombre" + light_appearance: "Passer au thème clair" powered_by: "Propulsé par {{ .Hugo }} & {{ .Congo }}" list: externalurl_title: "Lien d'article externe." no_articles: "Il n'y a pas encore d'articles ici." -# nav: -# scroll_to_top_title: "Scroll to top" -# skip_to_main: "Skip to main content" +nav: + scroll_to_top_title: "Faire défiler jusqu'au bas de la page" + skip_to_main: "Aller au contenu" -# search: -# open_button_title: "Search (/)" -# close_button_title: "Close (Esc)" -# input_placeholder: "Search" +search: + open_button_title: "Chercher (/)" + close_button_title: "Fermer (Esc)" + input_placeholder: "Chercher" sharing: email: "Envoyer par email" From f8558acb0109edca0b2e6c7f8ed61f01c3375490 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sat, 5 Feb 2022 09:59:42 +1100 Subject: [PATCH 2/5] =?UTF-8?q?=F0=9F=93=9D=20Add=20extra=20clarity=20to?= =?UTF-8?q?=20upgrade=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exampleSite/content/docs/configuration.md | 8 ++++++++ exampleSite/content/docs/getting-started.md | 2 +- .../content/docs/version-2/upgrade/index.md | 14 +++++++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/exampleSite/content/docs/configuration.md b/exampleSite/content/docs/configuration.md index 2b932d5d..ed952c48 100644 --- a/exampleSite/content/docs/configuration.md +++ b/exampleSite/content/docs/configuration.md @@ -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/`.| +### 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 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. diff --git a/exampleSite/content/docs/getting-started.md b/exampleSite/content/docs/getting-started.md index a7def8bc..1bb7319e 100644 --- a/exampleSite/content/docs/getting-started.md +++ b/exampleSite/content/docs/getting-started.md @@ -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. -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 # config/_default/menus.toml diff --git a/exampleSite/content/docs/version-2/upgrade/index.md b/exampleSite/content/docs/version-2/upgrade/index.md index 350d0404..cb681f3e 100644 --- a/exampleSite/content/docs/version-2/upgrade/index.md +++ b/exampleSite/content/docs/version-2/upgrade/index.md @@ -38,6 +38,8 @@ Then change into your project directory and execute the following command: 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). ### 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: ```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). @@ -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. +### 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 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 -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` **→** `assets/me.jpg` `static/logo.jpg` **→** `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 From 91b5b52c212f7d079aa869f88b26a520815e0b11 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sat, 5 Feb 2022 10:03:34 +1100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=93=9D=20Update=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1b8e62f..62e831d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Changed + +- Updated French translation ([#100](https://github.com/jpanther/congo/pull/100)) + ## [2.0.1] - 2022-02-03 ### Fixed From 09d2e410c86a23286101612a05fc8e9b314b030f Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sat, 5 Feb 2022 19:19:47 +1100 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=90=9B=20Stop=20site=20appearance=20t?= =?UTF-8?q?aking=20priority=20over=20user?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #102 --- CHANGELOG.md | 7 ++++++- assets/js/appearance.js | 27 ++++++++++++++++----------- layouts/_default/baseof.html | 5 ++--- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62e831d3..e2be5c06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - 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 ### Fixed @@ -42,7 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - ⚠️ All theme images are now Hugo assets - ⚠️ Overhauled `figure` shortcode which now resizes images - Upgrade to Tailwind v3.0.18 -- Inline Javascript moved to external files +- Inline JavaScript moved to external files - Improved JSON-LD structured data - Breadcrumbs now fallback to section name when `title` is not provided - Minor style and layout improvements diff --git a/assets/js/appearance.js b/assets/js/appearance.js index fc4d6095..686a13ea 100644 --- a/assets/js/appearance.js +++ b/assets/js/appearance.js @@ -1,11 +1,14 @@ const browserIsDark = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches; +const sitePreference = document.documentElement.getAttribute("data-default-appearance"); const userPreference = localStorage.getItem("appearance"); const switcher = document.getElementById("appearance-switcher"); if ( (browserIsDark && userPreference === null) || (browserIsDark && userPreference === "dark") || + (sitePreference === "dark" && userPreference === null) || + (sitePreference === "dark" && userPreference === "dark") || userPreference === "dark" ) { document.documentElement.classList.add("dark"); @@ -22,15 +25,17 @@ if (document.documentElement.getAttribute("data-auto-appearance") === "true") { } window.addEventListener("DOMContentLoaded", (event) => { - switcher.addEventListener("click", () => { - document.documentElement.classList.toggle("dark"); - localStorage.setItem( - "appearance", - document.documentElement.classList.contains("dark") ? "dark" : "light" - ); - }); - switcher.addEventListener("contextmenu", (event) => { - event.preventDefault(); - localStorage.removeItem("appearance"); - }); + if (switcher) { + switcher.addEventListener("click", () => { + document.documentElement.classList.toggle("dark"); + localStorage.setItem( + "appearance", + document.documentElement.classList.contains("dark") ? "dark" : "light" + ); + }); + switcher.addEventListener("contextmenu", (event) => { + event.preventDefault(); + localStorage.removeItem("appearance"); + }); + } }); diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 03904401..f73c4da0 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -8,9 +8,8 @@ {{- else -}} ltr {{- end }}" - class="scroll-smooth {{ if eq (.Site.Params.defaultAppearance | default "light") "dark" -}} - dark - {{- end }}" + class="scroll-smooth" + data-default-appearance="{{ .Site.Params.defaultAppearance | default "light" }}" data-auto-appearance="{{ .Site.Params.autoSwitchAppearance | default "true" }}" > {{- partial "head.html" . -}} From dd3606d33d8c9243dc0902c5d1c877aeb9acf0f3 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sat, 5 Feb 2022 19:42:23 +1100 Subject: [PATCH 5/5] =?UTF-8?q?=F0=9F=94=A8=20Preparing=20release=20v2.0.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 5 ++++- assets/css/compiled/main.css | 2 +- assets/css/main.css | 2 +- package.json | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2be5c06..d5450794 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## [2.0.2] - 2022-02-05 + ### Changed - Updated French translation ([#100](https://github.com/jpanther/congo/pull/100)) @@ -297,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 - 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.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 diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index f8fccc66..1b149d8a 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -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 */ diff --git a/assets/css/main.css b/assets/css/main.css index 9ff9cd85..616230a4 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -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 components; diff --git a/package.json b/package.json index 51727d16..a04d6bcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hugo-congo-theme", - "version": "2.0.1", + "version": "2.0.2", "description": "Congo theme for Hugo", "main": "index.js", "scripts": {