diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index e04ea386..bef9ab2b 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -1553,6 +1553,10 @@ select { margin-bottom: 2.25rem !important; } +.mt-20 { + margin-top: 5rem; +} + .-mr-2 { margin-right: -0.5rem; } diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index cf6c2c56..24e1c557 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -37,6 +37,25 @@ Don't forget to [follow me](https://twitter.com/nunocoracao) on Twitter. Don't forget to [follow me](https://twitter.com/nunocoracao) on Twitter. {{< /alert >}} +## Article +`Article` will embed a single article into a markdown file. The `link` to the file should be the `.RelPermalink` of the file to be embedded. Note that the shortcode will not display anything if it's referencing it's parent. + + +|Parameter|Description| +|---|---| +|`link`| **Required.** the `.RelPermalink` to the target article.| + + +**Example:** + +```md +{{}} +``` + +{{< article link="/docs/welcome/" >}} + + + ## Badge `badge` outputs a styled badge component which is useful for displaying metadata. @@ -164,6 +183,33 @@ Custom icons can be added by providing your own icon assets in the `assets/icons Icons can also be used in partials by calling the [icon partial]({{< ref "partials#icon" >}}). +## List +`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.| + + + +**Example #1:** +```md +{{}} +``` + +{{< list limit=2 >}} + +**Example #2:** +```md +{{}} +``` + +{{< list limit=2 where="Type" value="sample">}} + + ## Swatches `swatches` outputs a set of up to three different colors to showcase color elements like a color palette. This shortcode takes the `HEX` codes of each color and creates the visual elements for each. diff --git a/exampleSite/content/samples/emoji.md b/exampleSite/content/samples/emoji.md index 15f33857..2a27aa62 100755 --- a/exampleSite/content/samples/emoji.md +++ b/exampleSite/content/samples/emoji.md @@ -4,6 +4,7 @@ date: 2019-03-05 description: "Guide to Emoji usage in Blowfish" summary: "📖🏞️🧗🏽🐉🧙🏽‍♂️🧚🏽👸" tags: ["emoji", "sample"] +type: 'sample' --- Emoji is supported throughout Blowfish by default. Emoji can be used in titles, menu items and article content. diff --git a/layouts/partials/article-link.html b/layouts/partials/article-link.html index bf1da2c5..e6cf63ba 100644 --- a/layouts/partials/article-link.html +++ b/layouts/partials/article-link.html @@ -41,7 +41,7 @@
-

+
{{ with .Params.externalUrl }}
{{ else }} -

{{ .Title | emojify }}

+
{{ .Title | emojify }}
{{ end }} {{ if and .Draft .Site.Params.article.showDraftLabel }}
@@ -66,7 +66,7 @@ {{ if templates.Exists "partials/extend-article-link.html" }} {{ partial "extend-article-link.html" . }} {{ end }} -

+
{{ partial "article-meta.html" . }}
diff --git a/layouts/shortcodes/article.html b/layouts/shortcodes/article.html new file mode 100644 index 00000000..f0699d80 --- /dev/null +++ b/layouts/shortcodes/article.html @@ -0,0 +1,9 @@ +{{ $parent := .Page.RelPermalink }} +
+ {{ $RelPermalink := .Get "link" }} + {{ range ( where .Site.RegularPages "RelPermalink" $RelPermalink | first 1 ) }} + {{ if not (eq .RelPermalink $parent) }} + {{ partial "article-link.html" . }} + {{ end }} + {{end}} +
\ No newline at end of file diff --git a/layouts/shortcodes/list.html b/layouts/shortcodes/list.html new file mode 100644 index 00000000..dd95e81d --- /dev/null +++ b/layouts/shortcodes/list.html @@ -0,0 +1,21 @@ + +{{ $limit := .Get "limit" }} +{{ $parent := .Page.RelPermalink }} +{{ $where := .Get "where" }} +{{ $value := .Get "value" }} +

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

+
+ {{ if $where }} + {{ range ( where .Site.RegularPages $where $value | first 1 ) }} + {{ if not (eq .RelPermalink $parent) }} + {{ partial "article-link.html" . }} + {{ end }} + {{end}} + {{ else }} + {{ range .Site.RegularPages | first $limit }} + {{ if not (eq .RelPermalink $parent) }} + {{ partial "article-link.html" . }} + {{ end }} + {{end}} + {{ end }} +
\ No newline at end of file diff --git a/package.json b/package.json index f9e488bf..6c214be9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hugo-blowfish-theme", - "version": "1.5.2", + "version": "1.6.0", "description": "Blowfish theme for Hugo", "scripts": { "preinstall": "rimraf assets/vendor",