From 4e43a42406f9265363e208464b5342eb67bc28a6 Mon Sep 17 00:00:00 2001 From: Zekeriya AY Date: Sun, 6 Feb 2022 00:01:40 +0300 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=8C=90=20=20Update=20tr=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/tr.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) 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" From 63de2973ce5575c8d79609f5150320898b621d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Bele=C3=B1a?= Date: Sat, 5 Feb 2022 22:34:39 +0100 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=8C=90=20Update=20es=20i18n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- i18n/es.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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" From 60a62e2b4b30e2a1861b844072d6909f31754347 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sun, 6 Feb 2022 11:26:37 +1100 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=9A=B8=20Prevent=20image=20processing?= =?UTF-8?q?=20on=20external=20URLs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 5 +++ exampleSite/content/docs/shortcodes/index.md | 4 +-- layouts/_default/_markup/render-image.html | 34 +++++++++++------- layouts/shortcodes/figure.html | 38 ++++++++++++-------- 4 files changed, 51 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5450794..5f57525a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### 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 + ## [2.0.2] - 2022-02-05 ### Changed 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/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/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 From 37e01d1ea54210b571019675e5796b014f5ae6f6 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sun, 6 Feb 2022 11:31:36 +1100 Subject: [PATCH 4/8] =?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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f57525a..766efe36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### 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 From 88946105fd1bf664359d3dd3c38222ca277a11fe Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sun, 6 Feb 2022 14:46:03 +1100 Subject: [PATCH 5/8] =?UTF-8?q?=E2=9A=B0=EF=B8=8F=20Remove=20redundant=20a?= =?UTF-8?q?ppearance=20parameter=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref #102 --- layouts/partials/head.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/layouts/partials/head.html b/layouts/partials/head.html index cf213072..7ef02a9a 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -50,10 +50,8 @@ 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" }} + {{ $assets.Add "js" (slice $jsAppearance) }} {{ if .Site.Params.enableSearch | default false }} {{ $jsFuse := resources.Get "lib/fuse/fuse.min.js" }} {{ $jsSearch := resources.Get "js/search.js" }} From 39c1b7d04a6aba2dfc908a48bce74c5f01045b50 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Sun, 6 Feb 2022 15:10:59 +1100 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=90=9B=20Fix=20appearance=20pref=20no?= =?UTF-8?q?t=20loading=20early=20enough?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #102 --- CHANGELOG.md | 1 + assets/js/appearance.js | 2 +- layouts/partials/head.html | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 766efe36..ac13a63d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - 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 would briefly appear on page load before switching to dark appearance ([#102](https://github.com/jpanther/congo/issues/102)) ## [2.0.2] - 2022-02-05 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/layouts/partials/head.html b/layouts/partials/head.html index 7ef02a9a..e59f8efd 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -51,7 +51,8 @@ integrity="{{ $bundleCSS.Data.Integrity }}" /> {{ $jsAppearance := resources.Get "js/appearance.js" }} - {{ $assets.Add "js" (slice $jsAppearance) }} + {{ $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" }} From 99ccc612cb8db5b820c0bd45d8e287cc9849382c Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 7 Feb 2022 09:11:47 +1100 Subject: [PATCH 7/8] =?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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac13a63d..4dcac373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - 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 would briefly appear on page load before switching to dark appearance ([#102](https://github.com/jpanther/congo/issues/102)) +- 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 From 93625b169b1e580dbb20a43a05734492de499c36 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Mon, 7 Feb 2022 09:12:13 +1100 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=94=A8=20Preparing=20release=20v2.0.3?= 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 4dcac373..dad487e8 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.3] - 2022-02-07 + ### Changed - Updated Turkish translation ([#105](https://github.com/jpanther/congo/pull/105)) @@ -310,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/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": {