Skip to content

Commit

Permalink
Rework alert shortcode
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored and deining committed Feb 10, 2023
1 parent a497c22 commit e3b96d6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
4 changes: 4 additions & 0 deletions assets/scss/_alerts.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
border-width: 0 0 0 4px;
}
}

:last-child {
margin-bottom: 0;
}
}
19 changes: 11 additions & 8 deletions layouts/shortcodes/alert.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{{ $_hugo_config := `{ "version": 1 }` }}
{{ $color := .Get "color" | default "primary" }}
{{ $color := .Get "color" | default "primary" -}}
<div class="alert alert-{{ $color }}" role="alert">
{{ with .Get "title" }}<h4 class="alert-heading">{{ . | safeHTML }}</h4>{{ end }}
{{ if eq .Page.File.Ext "md" }}
{{ .Inner | markdownify }}
{{ else }}
{{ .Inner | htmlUnescape | safeHTML }}
{{ end }}
{{ with .Get "title" -}}
<h4 class="alert-heading">
{{- . | safeHTML -}}
</h4>
{{ end -}}
{{ if .Get "markdownify" -}}
{{ .Inner | markdownify }}
{{ else -}}
{{ .Inner }}
{{ end -}}
</div>
6 changes: 3 additions & 3 deletions userguide/content/en/docs/Deployment/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Then follow the instructions in [Host on Netlify](https://gohugo.io/hosting-and-
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).
1. Click **Deploy site**.

{{% alert title="Note" color="primary" %}}
{{% alert title="Note" %}}
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).

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:
Expand Down Expand Up @@ -138,11 +138,11 @@ deployment:

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.

{{% alert title="Automated deployment with GitHub actions" color="primary" %}}
{{% alert title="Automated deployment with GitHub actions" %}}
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/).
{{% /alert %}}

{{% alert title="Handling aliases" color="primary" %}}
{{% alert title="Handling aliases" %}}
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.
{{% /alert %}}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The **blocks/cover** shortcode creates a landing page type of block that fills t
Note that the relevant shortcode parameters above will have sensible defaults, but is included here for completeness.

{{% alert title="Hugo Tip" %}}
> 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.
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.
{{% /alert %}}


Expand Down

0 comments on commit e3b96d6

Please sign in to comment.