From 801353d8035452df1e42045cc699dac014461e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Tue, 24 Jan 2023 22:18:25 +0000 Subject: [PATCH 1/4] :bug: fixed typos in list shortcode docs --- exampleSite/content/docs/shortcodes/index.md | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index 392b445e..e8b80f9c 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -103,10 +103,10 @@ Call to action -| Parameter | Description | -| ---------------- | ----------------------------------------------------------------------------------------------------------------- | -| `images` | **Required.** A regex string to match image names. | -| `aspectRatio` | **Optional.** The aspect ratio for the carousel. Either `16-9`, `21-9` or `32-9`. It is set to `16-9` by default. | +| Parameter | Description | +| ------------- | ----------------------------------------------------------------------------------------------------------------- | +| `images` | **Required.** A regex string to match image names. | +| `aspectRatio` | **Optional.** The aspect ratio for the carousel. Either `16-9`, `21-9` or `32-9`. It is set to `16-9` by default. | **Example 1:** 16:9 aspect ratio and verbose list of images @@ -325,11 +325,15 @@ When life gives you lemons, make lemonade. `List` will display a list of recent articles. This shortcode requires a limit value to constraint the list. Additionally, it supports a `where` and a `value` in order to filter articles by their parameters. Note that this shortcode will not display its parent page but it will count for the limit value. -| Parameter | Description | -| --------- | ------------------------------------------------------- | -| `limit` | **Required.** the number of recent articles to display. | -| `where` | the number of recent articles to display. | -| `value` | the number of recent articles to display. | +| Parameter | Description | +| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `limit` | **Required.** the number of recent articles to display. | +| `where` | The variable to be used for the query of articles e.g. `Type` | +| `value` | The value that will need to match the parameter defined in `where` for the query of articles e.g. for `where` == `Type` a valid vaue could be `sample` | + +{{< alert >}} +The `where` and `value` values are used in the following query `where .Site.RegularPages $where $value` in the code of the shortcode +{{}} From 88b984c1b4436708aeb30eca40803407bc8ae78b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Tue, 24 Jan 2023 22:25:11 +0000 Subject: [PATCH 2/4] add link to hugo docs --- exampleSite/content/docs/shortcodes/index.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index e8b80f9c..d548c173 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -332,7 +332,7 @@ When life gives you lemons, make lemonade. | `value` | The value that will need to match the parameter defined in `where` for the query of articles e.g. for `where` == `Type` a valid vaue could be `sample` | {{< alert >}} -The `where` and `value` values are used in the following query `where .Site.RegularPages $where $value` in the code of the shortcode +The `where` and `value` values are used in the following query `where .Site.RegularPages $where $value` in the code of the shortcode. Check [Hugo docs](https://gohugo.io/variables/page/) to learn more about which parameters are available to use. {{}} @@ -353,6 +353,13 @@ The `where` and `value` values are used in the following query `where .Site.Regu {{< list limit=2 where="Type" value="sample">}} + + +asdasd + +{{< list limit=2 where="Tag" value="emoji">}} + +


## Mermaid From 3652ad0a5b1f560cbe20010ce2f1e1d2847d4205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Tue, 24 Jan 2023 22:26:43 +0000 Subject: [PATCH 3/4] removed unused example --- exampleSite/content/docs/shortcodes/index.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index d548c173..e5ef4177 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -354,12 +354,6 @@ The `where` and `value` values are used in the following query `where .Site.Regu {{< list limit=2 where="Type" value="sample">}} - -asdasd - -{{< list limit=2 where="Tag" value="emoji">}} - -


## Mermaid From 0dd1c14e7462dbcbae75d4ac1676923f9456ac89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20Cora=C3=A7=C3=A3o?= Date: Tue, 24 Jan 2023 22:35:14 +0000 Subject: [PATCH 4/4] final polish --- exampleSite/content/docs/shortcodes/index.md | 6 +++--- exampleSite/content/samples/charts.md | 1 + exampleSite/content/samples/diagrams-flowcharts.md | 1 + exampleSite/content/samples/external.md | 1 + exampleSite/content/samples/icons/index.md | 1 + exampleSite/content/samples/markdown.md | 1 + exampleSite/content/samples/mathematical-notation.md | 1 + exampleSite/content/samples/multiple-authors.md | 1 + exampleSite/content/samples/placeholder-text.md | 1 + exampleSite/content/samples/rich-content.md | 1 + exampleSite/content/samples/thumbnail_sample/index.md | 1 + layouts/shortcodes/list.html | 4 ++-- 12 files changed, 15 insertions(+), 5 deletions(-) diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index e5ef4177..1af3e972 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -329,7 +329,7 @@ When life gives you lemons, make lemonade. | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | | `limit` | **Required.** the number of recent articles to display. | | `where` | The variable to be used for the query of articles e.g. `Type` | -| `value` | The value that will need to match the parameter defined in `where` for the query of articles e.g. for `where` == `Type` a valid vaue could be `sample` | +| `value` | The value that will need to match the parameter defined in `where` for the query of articles e.g. for `where` == `Type` a valid value could be `sample` | {{< alert >}} The `where` and `value` values are used in the following query `where .Site.RegularPages $where $value` in the code of the shortcode. Check [Hugo docs](https://gohugo.io/variables/page/) to learn more about which parameters are available to use. @@ -348,10 +348,10 @@ The `where` and `value` values are used in the following query `where .Site.Regu **Example #2:** ```md -{{}} +{{}} ``` -{{< list limit=2 where="Type" value="sample">}} +{{< list limit=5 where="Type" value="sample">}}


diff --git a/exampleSite/content/samples/charts.md b/exampleSite/content/samples/charts.md index fd811486..aea13aa7 100755 --- a/exampleSite/content/samples/charts.md +++ b/exampleSite/content/samples/charts.md @@ -5,6 +5,7 @@ description: "Guide to Chart.js usage in Blowfish" summary: "Blowfish includes Chart.js for powerful charts and data visualisations." tags: ["chart", "sample", "graph", "shortcodes"] showDate: false +type: 'sample' --- Blowfish includes support for Chart.js using the `chart` shortcode. Simply wrap the chart markup within the shortcode. Blowfish automatically themes charts to match the configured `colorScheme` parameter, however the colours can be customised using normal Chart.js syntax. diff --git a/exampleSite/content/samples/diagrams-flowcharts.md b/exampleSite/content/samples/diagrams-flowcharts.md index 9e186fb5..e4f87161 100755 --- a/exampleSite/content/samples/diagrams-flowcharts.md +++ b/exampleSite/content/samples/diagrams-flowcharts.md @@ -4,6 +4,7 @@ date: 2019-03-06 description: "Guide to Mermaid usage in Blowfish" summary: "It's easy to add diagrams and flowcharts to articles using Mermaid." tags: ["mermaid", "sample", "diagram", "shortcodes"] +type: 'sample' --- Mermaid diagrams are supported in Blowfish using the `mermaid` shortcode. Simply wrap the diagram markup within the shortcode. Blowfish automatically themes Mermaid diagrams to match the configured `colorScheme` parameter. diff --git a/exampleSite/content/samples/external.md b/exampleSite/content/samples/external.md index b2402bb2..693924d3 100755 --- a/exampleSite/content/samples/external.md +++ b/exampleSite/content/samples/external.md @@ -9,6 +9,7 @@ showViews: false _build: render: "false" list: "local" +type: 'sample' --- This page uses the `externalUrl` front matter parameter to link to an article outside of this Hugo website. diff --git a/exampleSite/content/samples/icons/index.md b/exampleSite/content/samples/icons/index.md index 6ca29761..eecaa9ca 100644 --- a/exampleSite/content/samples/icons/index.md +++ b/exampleSite/content/samples/icons/index.md @@ -6,6 +6,7 @@ draft: false description: "Icon support in Blowfish." slug: "icons" tags: ["icons", "sample", "shortcodes"] +type: 'sample' --- Blowfish has built-in support for a number of [FontAwesome 6](https://fontawesome.com/icons) icons. These can be included in your website through either the [icon partial]({{< ref "docs/partials#icon" >}}) or [icon shortcode]({{< ref "docs/shortcodes#icon" >}}). diff --git a/exampleSite/content/samples/markdown.md b/exampleSite/content/samples/markdown.md index e1124da1..ee83f142 100755 --- a/exampleSite/content/samples/markdown.md +++ b/exampleSite/content/samples/markdown.md @@ -3,6 +3,7 @@ title: "Markdown" date: 2019-03-11 description: "Sample article showcasing basic Markdown syntax and formatting for HTML elements." tags: ["markdown", "css", "html", "sample"] +type: 'sample' --- This article offers a sample of basic Markdown formatting that can be used in Blowfish, also it shows how some basic HTML elements are decorated. diff --git a/exampleSite/content/samples/mathematical-notation.md b/exampleSite/content/samples/mathematical-notation.md index d5903165..f0590a0a 100755 --- a/exampleSite/content/samples/mathematical-notation.md +++ b/exampleSite/content/samples/mathematical-notation.md @@ -3,6 +3,7 @@ title: Mathematical notation date: 2019-03-08 description: A brief sample of mathematical notation in Blowfish. tags: ["sample", "katex", "maths", "shortcodes"] +type: 'sample' --- KaTeX can be used to render mathematical notation within articles. diff --git a/exampleSite/content/samples/multiple-authors.md b/exampleSite/content/samples/multiple-authors.md index d547a28a..0cd486f5 100644 --- a/exampleSite/content/samples/multiple-authors.md +++ b/exampleSite/content/samples/multiple-authors.md @@ -9,6 +9,7 @@ showAuthor: false authors: - "nunocoracao" - "secondauthor" +type: 'sample' --- This is an example of how an article with multiple authors will look like. \ No newline at end of file diff --git a/exampleSite/content/samples/placeholder-text.md b/exampleSite/content/samples/placeholder-text.md index e26a8e53..20c6ac1b 100755 --- a/exampleSite/content/samples/placeholder-text.md +++ b/exampleSite/content/samples/placeholder-text.md @@ -7,6 +7,7 @@ description: "Lorem Ipsum Dolor Si Amet" tags: ["markdown", "text", "sample", "latin"] showDateUpdated: true xml: false +type: 'sample' --- Lorem est tota propiore conpellat pectoribus de pectora summo. Redit teque digerit hominumque toris verebor lumina non cervice subde tollit usus habet Arctonque, furores quas nec ferunt. Quoque montibus nunc caluere tempus inhospita parcite confusaque translucet patri vestro qui optatis lumine cognoscere flos nubis! Fronde ipsamque patulos Dryopen deorum. diff --git a/exampleSite/content/samples/rich-content.md b/exampleSite/content/samples/rich-content.md index 4946e58a..d46b16d0 100755 --- a/exampleSite/content/samples/rich-content.md +++ b/exampleSite/content/samples/rich-content.md @@ -4,6 +4,7 @@ date: 2019-03-10 description: "A brief description of Hugo Shortcodes" summary: "This is an _example_ of a **rich** content summary." tags: ["shortcodes", "privacy", "sample", "gist", "twitter", "youtube", "vimeo"] +type: 'sample' --- Hugo ships with several [built-in shortcodes](https://gohugo.io/content-management/shortcodes/#use-hugos-built-in-shortcodes) for rich content, along with a [privacy config](https://gohugo.io/about/hugo-and-gdpr/) and a set of _simple shortcodes_ that enable static and no-JS versions of various social media embeds. diff --git a/exampleSite/content/samples/thumbnail_sample/index.md b/exampleSite/content/samples/thumbnail_sample/index.md index 46d39aee..06f4118d 100644 --- a/exampleSite/content/samples/thumbnail_sample/index.md +++ b/exampleSite/content/samples/thumbnail_sample/index.md @@ -6,6 +6,7 @@ description: "Turn on thumbnails for your articles." slug: "thumbnail_sample" tags: ["thumbnail", "sample"] summary: "A quick example of how to start using Thumbnails in your artciles." +type: 'sample' --- A quick example of how to start using Thumbnails in your articles. diff --git a/layouts/shortcodes/list.html b/layouts/shortcodes/list.html index 63b975b4..96357b33 100644 --- a/layouts/shortcodes/list.html +++ b/layouts/shortcodes/list.html @@ -1,12 +1,12 @@ -{{ $limit := .Get "limit" }} +{{ $limit := .Get "limit" | default 1 }} {{ $parent := .Page.RelPermalink }} {{ $where := .Get "where" }} {{ $value := .Get "value" }}

{{ i18n "shortcode.recent_articles" | emojify }}

{{ if $where }} - {{ range ( where .Site.RegularPages $where $value | first 1 ) }} + {{ range ( where .Site.RegularPages $where $value | first $limit ) }} {{ if not (eq .RelPermalink $parent) }} {{ partial "article-link/simple.html" . }} {{ end }}