diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 64a7132..8efa59d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,9 @@ on: push: branches: - main + pull_request: + branches: + - main # Allows to run this workflow manually from the Actions tab workflow_dispatch: @@ -24,16 +27,16 @@ jobs: - name: Download and setup Hugo uses: peaceiris/actions-hugo@v3 env: - HUGO_RELEASE: '0.155.3' + HUGO_RELEASE: '0.159.1' with: hugo-version: ${{ env.HUGO_RELEASE }} extended: true - name: Check Hugo installation run: hugo env - name: Setup Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: '18' + node-version: '24' - name: Cache dependencies uses: actions/cache@v4 with: @@ -51,6 +54,7 @@ jobs: --printI18nWarnings \ --cacheDir "${{ runner.temp }}/hugo_cache" - name: Deploy website with rsync + if: github.event_name == 'push' && github.ref_name == 'main' uses: burnett01/rsync-deployments@v8 with: switches: -avzr --quiet --delete diff --git a/assets/js/custom.js b/assets/js/custom.js index 5f71d37..eb7c915 100755 --- a/assets/js/custom.js +++ b/assets/js/custom.js @@ -24,7 +24,12 @@ var tour = new Tour({ ] }); -availableLanguages = [{{ printf "'%s'" (delimit site.Languages "','") }}]; +availableLanguages = [ +{{- range hugo.Sites -}} +'{{- .Language -}}', +{{- end -}} +]; + // Check if browser language matches document language and language version exists. if (userLanguage !== document.documentElement.lang && availableLanguages.includes(userLanguage)) { diff --git a/config.yml b/config.yml index ac6da53..2fd4d1d 100644 --- a/config.yml +++ b/config.yml @@ -1,9 +1,11 @@ baseURL: 'https://moodletoolguide.net/' -languageCode: en-us # Site language. Available translations in the theme's `/i18n` directory. defaultContentLanguage: en +# Site time zone +timeZone: Europe/Zurich + # Whether to publish the default content language to a subdirectory matching the defaultContentLanguage defaultContentLanguageInSubdir: true @@ -40,7 +42,8 @@ params: languages: en: - languageName: English + label: English + locale: en-us weight: 1 title: Moodle Tool Guide contentDir: content/en @@ -73,7 +76,8 @@ languages: date_format: January 2, 2006 fr: - languageName: Français + label: Français + locale: fr-fr weight: 2 title: Guide des outils Moodle contentDir: content/fr @@ -105,7 +109,8 @@ languages: date_format: 2 January 2006 it: - languageName: Italiano + label: Italiano + locale: it-it weight: 3 title: Guida agli strumenti Moodle contentDir: content/it @@ -138,7 +143,8 @@ languages: date_format: 2 January 2006 de: - languageName: Deutsch + label: Deutsch + locale: de-de weight: 4 title: Moodle-Werkzeuge für Lehrpersonen contentDir: content/de @@ -174,7 +180,8 @@ languages: date_format: 2. January 2006 es: - languageName: Español + label: Español + locale: es-es weight: 5 title: Guía de las herramientas de Moodle contentDir: content/es @@ -207,7 +214,8 @@ languages: date_format: 2 January 2006 nl: - languageName: Nederlands + label: Nederlands + locale: nl-nl weight: 6 title: Moodle Gereedschapsgids contentDir: content/nl @@ -243,7 +251,8 @@ languages: date_format: 2 January 2006 eu: - languageName: Euskara + label: Euskara + locale: eu weight: 7 title: Moodleko Tresnen Gida contentDir: content/eu @@ -279,7 +288,8 @@ languages: date_format: 2006 January 2 pt-br: - languageName: Português (Brasil) + label: Português (Brasil) + locale: pt-br weight: 8 title: Guia de Ferramentas Moodle contentDir: content/pt-br @@ -311,7 +321,8 @@ languages: date_format: 2 January 2006 pt-pt: - languageName: Português + label: Português + locale: pt-pt weight: 9 title: Guia de Ferramentas do Moodle contentDir: content/pt-pt @@ -343,7 +354,8 @@ languages: date_format: 2 January 2006 zh: - languageName: 中文 + label: 中文 + locale: zh-cn weight: 10 title: Moodle Tool Guide contentDir: content/zh @@ -376,7 +388,8 @@ languages: date_format: January 2, 2006 fi: - languageName: Suomi + label: Suomi + locale: fi-fi weight: 12 title: Moodle-työkaluopas contentDir: content/fi @@ -408,7 +421,8 @@ languages: date_format: 2 January 2006 et: - languageName: Eesti + label: Eesti + locale: et-ee weight: 13 title: Moodle'i tööriistade juhend contentDir: content/et @@ -441,7 +455,8 @@ languages: date_format: 2 January 2006 sv: - languageName: Svenska + label: Svenska + locale: sv-se weight: 11 title: Moodle-verktygsguide contentDir: content/sv diff --git a/layouts/_default/robots.txt b/layouts/_default/robots.txt index 3c3e0a3..d4b8e8e 100644 --- a/layouts/_default/robots.txt +++ b/layouts/_default/robots.txt @@ -1,13 +1,10 @@ User-agent: * - {{ range .Sites }} {{- range where site.RegularPages "Params.robotsdisallow" true -}} Disallow: {{ .RelPermalink }} - {{- end }} -{{ end }} -Sitemap: {{ "sitemap.xml" | absURL -}} -{{- if hugo.IsMultilingual }} -{{ range site.Languages -}} - Sitemap: {{ printf "%s/sitemap.xml" .Lang | absURL }} + {{- end -}} {{ end }} +Sitemap: {{ "sitemap.xml" | absURL }} +{{ range hugo.Sites -}} + Sitemap: {{ .Home.Permalink }}sitemap.xml {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index a386af7..63872ff 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -47,28 +47,7 @@ {{ end }} {{ end }} - {{ if hugo.IsMultilingual }} -
- {{ end }} + {{ partial "langswitcher" . }} diff --git a/layouts/partials/langswitcher.html b/layouts/partials/langswitcher.html new file mode 100644 index 0000000..9d5ac81 --- /dev/null +++ b/layouts/partials/langswitcher.html @@ -0,0 +1,14 @@ +