Skip to content

Commit e3b96d6

Browse files
chalinurban-adeininger
authored andcommitted
Rework alert shortcode
1 parent a497c22 commit e3b96d6

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

assets/scss/_alerts.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@
1717
border-width: 0 0 0 4px;
1818
}
1919
}
20+
21+
:last-child {
22+
margin-bottom: 0;
23+
}
2024
}

layouts/shortcodes/alert.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
{{ $_hugo_config := `{ "version": 1 }` }}
2-
{{ $color := .Get "color" | default "primary" }}
1+
{{ $color := .Get "color" | default "primary" -}}
32
<div class="alert alert-{{ $color }}" role="alert">
4-
{{ with .Get "title" }}<h4 class="alert-heading">{{ . | safeHTML }}</h4>{{ end }}
5-
{{ if eq .Page.File.Ext "md" }}
6-
{{ .Inner | markdownify }}
7-
{{ else }}
8-
{{ .Inner | htmlUnescape | safeHTML }}
9-
{{ end }}
3+
{{ with .Get "title" -}}
4+
<h4 class="alert-heading">
5+
{{- . | safeHTML -}}
6+
</h4>
7+
{{ end -}}
8+
{{ if .Get "markdownify" -}}
9+
{{ .Inner | markdownify }}
10+
{{ else -}}
11+
{{ .Inner }}
12+
{{ end -}}
1013
</div>

userguide/content/en/docs/Deployment/_index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Then follow the instructions in [Host on Netlify](https://gohugo.io/hosting-and-
5252
If you don't want your site to be indexed by search engines, you can add an environment flag to your build command to specify a non-`production` environment, as described in [Build environments and indexing](#build-environments-and-indexing).
5353
1. Click **Deploy site**.
5454

55-
{{% alert title="Note" color="primary" %}}
55+
{{% alert title="Note" %}}
5656
Netlify uses your site repo's `package.json` file to install any JavaScript dependencies (like `postcss`) before building your site. If you haven't just copied our example site's version of this file, make sure that you've specified all our [prerequisites](/docs/get-started/docsy-as-module/installation-prerequisites/#install-postcss).
5757

5858
For example, if you want to use a version of `postcss-cli` later than version 8.0.0, you need to ensure that your `package.json` also specifies `postcss` separately:
@@ -138,11 +138,11 @@ deployment:
138138

139139
For more information about the Hugo `deploy` command, including command line options, see this [synopsis](https://gohugo.io/commands/hugo_deploy). In particular, you may find the `--maxDeletes int` option or the `--force` option (which forces upload of all files) useful.
140140

141-
{{% alert title="Automated deployment with GitHub actions" color="primary" %}}
141+
{{% alert title="Automated deployment with GitHub actions" %}}
142142
If the source of your site lives in a GitHub repository, you can use [GitHub Actions](https://docs.github.com/en/actions) to deploy the site to your S3 bucket as soon as you commit changes to your GitHub repo. Setup of this workflow is described in this [blog post](https://capgemini.github.io/development/Using-GitHub-Actions-and-Hugo-Deploy-to-Deploy-to-AWS/).
143143
{{% /alert %}}
144144

145-
{{% alert title="Handling aliases" color="primary" %}}
145+
{{% alert title="Handling aliases" %}}
146146
If you are using [aliases](https://gohugo.io/content-management/urls/#aliases) for URL management, you should have a look at this [blog post](https://blog.cavelab.dev/2021/10/hugo-aliases-to-s3-redirects/). It explains how to turn aliases into proper `301` redirects when using Amazon S3.
147147
{{% /alert %}}
148148

userguide/content/en/docs/adding-content/shortcodes/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The **blocks/cover** shortcode creates a landing page type of block that fills t
4949
Note that the relevant shortcode parameters above will have sensible defaults, but is included here for completeness.
5050

5151
{{% alert title="Hugo Tip" %}}
52-
> Using the bracket styled shortcode delimiter, `>}}`, tells Hugo that the inner content is HTML/plain text and needs no further processing. Changing the delimiter to `%}}` means Hugo will treat the content as Markdown. You can use both styles in your pages.
52+
Using the bracket styled shortcode delimiter, `>}}`, tells Hugo that the inner content is HTML/plain text and needs no further processing. Changing the delimiter to `%}}` means Hugo will treat the content as Markdown. You can use both styles in your pages.
5353
{{% /alert %}}
5454

5555

0 commit comments

Comments
 (0)