diff --git a/CHANGELOG.md b/CHANGELOG.md index d5450794..dad487e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## [2.0.3] - 2022-02-07 + +### Changed + +- Updated Turkish translation ([#105](https://github.com/jpanther/congo/pull/105)) +- Updated Spanish translation ([#106](https://github.com/jpanther/congo/pull/106)) + +### Fixed + +- Markdown images and `figure` shortcode fail to load resource when providing an external URL source +- HTML `figcaption` tags are output for Markdown images even when a caption is not provided +- Light appearance briefly appears on page load before switching to dark appearance ([#102](https://github.com/jpanther/congo/issues/102)) + ## [2.0.2] - 2022-02-05 ### Changed @@ -299,7 +312,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.2...HEAD +[unreleased]: https://github.com/jpanther/congo/compare/v2.0.3...HEAD +[2.0.3]: https://github.com/jpanther/congo/compare/v2.0.2...v2.0.3 [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 diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 1b149d8a..89b6a391 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1,4 +1,4 @@ -/*! Congo v2.0.2 | MIT License | https://github.com/jpanther/congo */ +/*! Congo v2.0.3 | 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 616230a4..c4b39302 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -1,4 +1,4 @@ -/*! Congo v2.0.2 | MIT License | https://github.com/jpanther/congo */ +/*! Congo v2.0.3 | MIT License | https://github.com/jpanther/congo */ @tailwind base; @tailwind components; diff --git a/assets/js/appearance.js b/assets/js/appearance.js index 686a13ea..f69b1f0c 100644 --- a/assets/js/appearance.js +++ b/assets/js/appearance.js @@ -2,7 +2,6 @@ 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) || @@ -25,6 +24,7 @@ if (document.documentElement.getAttribute("data-auto-appearance") === "true") { } window.addEventListener("DOMContentLoaded", (event) => { + const switcher = document.getElementById("appearance-switcher"); if (switcher) { switcher.addEventListener("click", () => { document.documentElement.classList.toggle("dark"); diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index 2df0149c..cf117647 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -99,14 +99,14 @@ You can see some additional Chart.js examples on the [charts samples]({{< ref "c Congo includes a `figure` shortcode for adding images to content. The shortcode replaces the base Hugo functionality in order to provide additional performance benefits. -Images included using `figure` will be optimised using Hugo Pipes and scaled in order to provide images appropriate to different device resolutions. +When a provided image is a page resource, it will be optimised using Hugo Pipes and scaled in order to provide images appropriate to different device resolutions. If a URL to an external image is provided, it will be included as-is without any image processing by Hugo. The `figure` shortcode accepts six parameters: |Parameter|Description| |---|---| -|`src`|**Required.** The filename of the image. This image must be a [page resource](https://gohugo.io/content-management/page-resources/) bundled with the page.| +|`src`|**Required.** The filename or URL of the image. When providing a filename, this image must be a [page resource](https://gohugo.io/content-management/page-resources/) bundled with the page.| |`alt`|[Alternative text description](https://moz.com/learn/seo/alt-text) for the image.| |`caption`|Markdown for the image caption, which will be displayed below the image.| |`class`|Additional CSS classes to apply to the image.| diff --git a/i18n/es.yaml b/i18n/es.yaml index 8ff30397..0e821b9d 100644 --- a/i18n/es.yaml +++ b/i18n/es.yaml @@ -8,7 +8,7 @@ article: one: "{{ .Count }} min" other: "{{ .Count }} mins" reading_time_title: "Tiempo de lectura" - # table_of_contents: "Table of Contents" + table_of_contents: "Tabla de contenido" word_count: one: "{{ .Count }} palabra" other: "{{ .Count }} palabras" @@ -16,9 +16,9 @@ article: author: byline_title: "Autor" -# code: -# copy: "Copy" -# copied: "Copied" +code: + copy: "Copiar" + copied: "Copiado" error: 404_title: "Página no encontrada :confused:" @@ -34,14 +34,14 @@ list: externalurl_title: "Link a página externa" no_articles: "Aún no hay artículos para listar aquí." -# nav: -# scroll_to_top_title: "Scroll to top" -# skip_to_main: "Skip to main content" +nav: + scroll_to_top_title: "Ir arriba" + skip_to_main: "Ir al contenido" -# search: -# open_button_title: "Search (/)" -# close_button_title: "Close (Esc)" -# input_placeholder: "Search" +search: + open_button_title: "Buscar (/)" + close_button_title: "Cerrar (Esc)" + input_placeholder: "Buscar" sharing: email: "Enviar vía email" diff --git a/i18n/tr.yaml b/i18n/tr.yaml index cdbcf844..7361c640 100644 --- a/i18n/tr.yaml +++ b/i18n/tr.yaml @@ -1,7 +1,7 @@ article: - anchor_label: "Anchor" + # anchor_label: "Anchor" date: "{{ .Date }}" - # date_updated: "Updated: {{ .Date }}" + date_updated: "Güncellendi: {{ .Date }}" draft: "Taslak" edit_title: "İçeriği düzenle" reading_time: @@ -15,9 +15,9 @@ article: author: byline_title: "Yazar" -# code: -# copy: "Copy" -# copied: "Copied" +code: + copy: "Kopyala" + copied: "Kopyalandı" error: 404_title: "Sayfa Bulunamadı :confused:" @@ -27,20 +27,20 @@ error: footer: dark_appearance: "Koyu görünüme geç" light_appearance: "Açık görünüme geç" - powered_by: "{{ .Hugo }} & {{ .Congo }} tarafından desteklenmektedir" + powered_by: "{{ .Hugo }} & {{ .Congo }} tarafından desteklenmektedir." list: externalurl_title: "Harici siteye bağlantı" no_articles: "Henüz burada listelenecek bir makale yok." -# nav: -# scroll_to_top_title: "Scroll to top" -# skip_to_main: "Skip to main content" +nav: + scroll_to_top_title: "Yukarı çık" + skip_to_main: "Ana içeriğe geç" -# search: -# open_button_title: "Search (/)" -# close_button_title: "Close (Esc)" -# input_placeholder: "Search" +search: + open_button_title: "Ara (/)" + close_button_title: "Kapat (Esc)" + input_placeholder: "Ara" sharing: email: "Email ile gönder" diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html index 6c01a4b4..ad27611c 100644 --- a/layouts/_default/_markup/render-image.html +++ b/layouts/_default/_markup/render-image.html @@ -1,19 +1,27 @@ +{{ $url := urls.Parse .Destination }} {{ $altText := .Text }} {{ $caption := .Title }} -{{ with $.Page.Resources.GetMatch (.Destination) }} +{{ if findRE "^https?" $url.Scheme }}
- {{ $altText }} -
{{ $caption | markdownify }}
+ {{ $altText }} + {{ with $caption }}
{{ . | markdownify }}
{{ end }}
{{ else }} - {{ errorf `[CONGO] Markdown image error in "%s": Resource "%s" not found. Check the path is correct or remove the image from the content.` .Page.Path .Destination }} + {{ with $.Page.Resources.GetMatch ($url.String) }} +
+ {{ $altText }} + {{ with $caption }}
{{ . | markdownify }}
{{ end }} +
+ {{ else }} + {{ errorf `[CONGO] Markdown image error in "%s": Resource "%s" not found. Check the path is correct or remove the image from the content.` .Page.Path $url.String }} + {{ end }} {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index cf213072..e59f8efd 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -50,10 +50,9 @@ href="{{ $bundleCSS.RelPermalink }}" integrity="{{ $bundleCSS.Data.Integrity }}" /> - {{ if .Site.Params.enableAppearanceSwitching | default true }} - {{ $jsAppearance := resources.Get "js/appearance.js" }} - {{ $assets.Add "js" (slice $jsAppearance) }} - {{ end }} + {{ $jsAppearance := resources.Get "js/appearance.js" }} + {{ $jsAppearance = $jsAppearance | resources.Minify | resources.Fingerprint "sha512" }} + {{ if .Site.Params.enableSearch | default false }} {{ $jsFuse := resources.Get "lib/fuse/fuse.min.js" }} {{ $jsSearch := resources.Get "js/search.js" }} diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 4bca0c15..cc9c7f2b 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -1,27 +1,35 @@ {{ if .Get "default" }} {{ template "_internal/shortcodes/figure.html" . }} {{ else }} + {{ $url := urls.Parse (.Get "src") }} {{ $altText := .Get "alt" }} {{ $caption := .Get "caption" }} {{ $href := .Get "href" }} {{ $class := .Get "class" }} - {{ with $.Page.Resources.GetMatch (.Get "src") }} -
- {{ with $href }}{{ end }} - {{ $altText }} - {{ if $href }}{{ end }} + {{ if findRE "^https?" $url.Scheme }} +
+ {{ $altText }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
{{ else }} - {{ errorf `[CONGO] Shortcode "figure" error in "%s": Resource "%s" not found. Check the path is correct or remove the shortcode.` .Page.Path (.Get "src") }} + {{ with $.Page.Resources.GetMatch ($url.String) }} +
+ {{ with $href }}{{ end }} + {{ $altText }} + {{ if $href }}{{ end }} + {{ with $caption }}
{{ . | markdownify }}
{{ end }} +
+ {{ else }} + {{ errorf `[CONGO] Shortcode "figure" error in "%s": Resource "%s" not found. Check the path is correct or remove the shortcode.` .Page.Path ($url.String) }} + {{ end }} {{ end }} {{ end }} \ No newline at end of file diff --git a/package.json b/package.json index a04d6bcd..96d928de 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hugo-congo-theme", - "version": "2.0.2", + "version": "2.0.3", "description": "Congo theme for Hugo", "main": "index.js", "scripts": {