🔖 Release v2.0.3

pull/155/head v2.0.3
James Panther 2022-02-07 09:12:16 +11:00
commit 56ec1bf578
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
11 changed files with 92 additions and 63 deletions

View File

@ -6,6 +6,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased] ## [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 ## [2.0.2] - 2022-02-05
### Changed ### 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 - Advanced customisation using simple Tailwind colour definitions and styles
- Fully documented - 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.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

View File

@ -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 */ /*! tailwindcss v3.0.18 | MIT License | https://tailwindcss.com */

View File

@ -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 base;
@tailwind components; @tailwind components;

View File

@ -2,7 +2,6 @@ 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 sitePreference = document.documentElement.getAttribute("data-default-appearance");
const userPreference = localStorage.getItem("appearance"); const userPreference = localStorage.getItem("appearance");
const switcher = document.getElementById("appearance-switcher");
if ( if (
(browserIsDark && userPreference === null) || (browserIsDark && userPreference === null) ||
@ -25,6 +24,7 @@ if (document.documentElement.getAttribute("data-auto-appearance") === "true") {
} }
window.addEventListener("DOMContentLoaded", (event) => { window.addEventListener("DOMContentLoaded", (event) => {
const switcher = document.getElementById("appearance-switcher");
if (switcher) { if (switcher) {
switcher.addEventListener("click", () => { switcher.addEventListener("click", () => {
document.documentElement.classList.toggle("dark"); document.documentElement.classList.toggle("dark");

View File

@ -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. 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: The `figure` shortcode accepts six parameters:
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
|Parameter|Description| |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.| |`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.| |`caption`|Markdown for the image caption, which will be displayed below the image.|
|`class`|Additional CSS classes to apply to the image.| |`class`|Additional CSS classes to apply to the image.|

View File

@ -8,7 +8,7 @@ article:
one: "{{ .Count }} min" one: "{{ .Count }} min"
other: "{{ .Count }} mins" other: "{{ .Count }} mins"
reading_time_title: "Tiempo de lectura" reading_time_title: "Tiempo de lectura"
# table_of_contents: "Table of Contents" table_of_contents: "Tabla de contenido"
word_count: word_count:
one: "{{ .Count }} palabra" one: "{{ .Count }} palabra"
other: "{{ .Count }} palabras" other: "{{ .Count }} palabras"
@ -16,9 +16,9 @@ article:
author: author:
byline_title: "Autor" byline_title: "Autor"
# code: code:
# copy: "Copy" copy: "Copiar"
# copied: "Copied" copied: "Copiado"
error: error:
404_title: "Página no encontrada :confused:" 404_title: "Página no encontrada :confused:"
@ -34,14 +34,14 @@ list:
externalurl_title: "Link a página externa" externalurl_title: "Link a página externa"
no_articles: "Aún no hay artículos para listar aquí." no_articles: "Aún no hay artículos para listar aquí."
# nav: nav:
# scroll_to_top_title: "Scroll to top" scroll_to_top_title: "Ir arriba"
# skip_to_main: "Skip to main content" skip_to_main: "Ir al contenido"
# search: search:
# open_button_title: "Search (/)" open_button_title: "Buscar (/)"
# close_button_title: "Close (Esc)" close_button_title: "Cerrar (Esc)"
# input_placeholder: "Search" input_placeholder: "Buscar"
sharing: sharing:
email: "Enviar vía email" email: "Enviar vía email"

View File

@ -1,7 +1,7 @@
article: article:
anchor_label: "Anchor" # anchor_label: "Anchor"
date: "{{ .Date }}" date: "{{ .Date }}"
# date_updated: "Updated: {{ .Date }}" date_updated: "Güncellendi: {{ .Date }}"
draft: "Taslak" draft: "Taslak"
edit_title: "İçeriği düzenle" edit_title: "İçeriği düzenle"
reading_time: reading_time:
@ -15,9 +15,9 @@ article:
author: author:
byline_title: "Yazar" byline_title: "Yazar"
# code: code:
# copy: "Copy" copy: "Kopyala"
# copied: "Copied" copied: "Kopyalandı"
error: error:
404_title: "Sayfa Bulunamadı :confused:" 404_title: "Sayfa Bulunamadı :confused:"
@ -27,20 +27,20 @@ error:
footer: footer:
dark_appearance: "Koyu görünüme geç" dark_appearance: "Koyu görünüme geç"
light_appearance: "Açık görünüme geç" light_appearance: "Açık görünüme geç"
powered_by: "{{ .Hugo }} &amp; {{ .Congo }} tarafından desteklenmektedir" powered_by: "{{ .Hugo }} &amp; {{ .Congo }} tarafından desteklenmektedir."
list: list:
externalurl_title: "Harici siteye bağlantı" externalurl_title: "Harici siteye bağlantı"
no_articles: "Henüz burada listelenecek bir makale yok." no_articles: "Henüz burada listelenecek bir makale yok."
# nav: nav:
# scroll_to_top_title: "Scroll to top" scroll_to_top_title: "Yukarı çık"
# skip_to_main: "Skip to main content" skip_to_main: "Ana içeriğe geç"
# search: search:
# open_button_title: "Search (/)" open_button_title: "Ara (/)"
# close_button_title: "Close (Esc)" close_button_title: "Kapat (Esc)"
# input_placeholder: "Search" input_placeholder: "Ara"
sharing: sharing:
email: "Email ile gönder" email: "Email ile gönder"

View File

@ -1,19 +1,27 @@
{{ $url := urls.Parse .Destination }}
{{ $altText := .Text }} {{ $altText := .Text }}
{{ $caption := .Title }} {{ $caption := .Title }}
{{ with $.Page.Resources.GetMatch (.Destination) }} {{ if findRE "^https?" $url.Scheme }}
<figure> <figure>
<img <img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
class="my-0 rounded-md" {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
alt="{{ $altText }}"
/>
<figcaption>{{ $caption | markdownify }}</figcaption>
</figure> </figure>
{{ else }} {{ 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) }}
<figure>
<img
class="my-0 rounded-md"
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
alt="{{ $altText }}"
/>
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure>
{{ 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 }} {{ end }}

View File

@ -50,10 +50,9 @@
href="{{ $bundleCSS.RelPermalink }}" href="{{ $bundleCSS.RelPermalink }}"
integrity="{{ $bundleCSS.Data.Integrity }}" integrity="{{ $bundleCSS.Data.Integrity }}"
/> />
{{ if .Site.Params.enableAppearanceSwitching | default true }} {{ $jsAppearance := resources.Get "js/appearance.js" }}
{{ $jsAppearance := resources.Get "js/appearance.js" }} {{ $jsAppearance = $jsAppearance | resources.Minify | resources.Fingerprint "sha512" }}
{{ $assets.Add "js" (slice $jsAppearance) }} <script type="text/javascript" src="{{ $jsAppearance.RelPermalink }}" integrity="{{ $jsAppearance.Data.Integrity }}"></script>
{{ end }}
{{ if .Site.Params.enableSearch | default false }} {{ if .Site.Params.enableSearch | default false }}
{{ $jsFuse := resources.Get "lib/fuse/fuse.min.js" }} {{ $jsFuse := resources.Get "lib/fuse/fuse.min.js" }}
{{ $jsSearch := resources.Get "js/search.js" }} {{ $jsSearch := resources.Get "js/search.js" }}

View File

@ -1,27 +1,35 @@
{{ if .Get "default" }} {{ if .Get "default" }}
{{ template "_internal/shortcodes/figure.html" . }} {{ template "_internal/shortcodes/figure.html" . }}
{{ else }} {{ else }}
{{ $url := urls.Parse (.Get "src") }}
{{ $altText := .Get "alt" }} {{ $altText := .Get "alt" }}
{{ $caption := .Get "caption" }} {{ $caption := .Get "caption" }}
{{ $href := .Get "href" }} {{ $href := .Get "href" }}
{{ $class := .Get "class" }} {{ $class := .Get "class" }}
{{ with $.Page.Resources.GetMatch (.Get "src") }} {{ if findRE "^https?" $url.Scheme }}
<figure {{ with $class }}class="{{ . }}"{{ end }}> <figure>
{{ with $href }}<a href="{{ . }}">{{ end }} <img class="my-0 rounded-md" src="{{ $url.String }}" alt="{{ $altText }}" />
<img
class="my-0 rounded-md"
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
alt="{{ $altText }}"
/>
{{ if $href }}</a>{{ end }}
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }} {{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure> </figure>
{{ else }} {{ 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) }}
<figure {{ with $class }}class="{{ . }}"{{ end }}>
{{ with $href }}<a href="{{ . }}">{{ end }}
<img
class="my-0 rounded-md"
srcset="
{{ (.Resize "330x").RelPermalink }} 330w,
{{ (.Resize "660x").RelPermalink }} 660w,
{{ (.Resize "1024x").RelPermalink }} 1024w,
{{ (.Resize "1320x").RelPermalink }} 2x"
src="{{ (.Resize "660x").RelPermalink }}"
alt="{{ $altText }}"
/>
{{ if $href }}</a>{{ end }}
{{ with $caption }}<figcaption>{{ . | markdownify }}</figcaption>{{ end }}
</figure>
{{ 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 }}
{{ end }} {{ end }}

View File

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