From bbdea7c507a8851213f8e8e1c33647766ac50688 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Tue, 7 Mar 2023 21:21:26 -0800 Subject: [PATCH] Add alerts --- README.md | 6 ++++++ exampleSite/content/content/complex-alert.md | 21 ++++++++++++++++++++ exampleSite/content/content/simple-alert.md | 17 ++++++++++++++++ layouts/_default/paige/home.html | 1 + layouts/partials/paige/alert.html | 9 +++++++++ layouts/partials/paige/article.html | 1 + 6 files changed, 55 insertions(+) create mode 100644 exampleSite/content/content/complex-alert.md create mode 100644 exampleSite/content/content/simple-alert.md create mode 100644 layouts/partials/paige/alert.html diff --git a/README.md b/README.md index 8655a6a0..ad205bd3 100644 --- a/README.md +++ b/README.md @@ -339,6 +339,12 @@ authors: - author: "will-faught" # Credit the corresponding author in the site parameters - name: "Will Faught" # Credit this author link: "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title +paige: + alert: "Alert!" # Markdown displayed before the page body (defaults to primary alert type) +paige: + alert: + message: "Alert!" # Markdown displayed before the page body + type: "primary" # Bootstrap alert type ``` ## Layouts diff --git a/exampleSite/content/content/complex-alert.md b/exampleSite/content/content/complex-alert.md new file mode 100644 index 00000000..c95f0f22 --- /dev/null +++ b/exampleSite/content/content/complex-alert.md @@ -0,0 +1,21 @@ +--- +authors: ["will-faught"] +categories: ["content", "paige"] +description: "A complex alert." +paige: + alert: + message: "Get more information here." + type: "danger" +tags: ["alerts"] +title: "Complex Alert" +weight: 70 +--- + +This page has the following parameters: + +```yaml +paige: + alert: + message: "Get more information here." + type: "danger" +``` diff --git a/exampleSite/content/content/simple-alert.md b/exampleSite/content/content/simple-alert.md new file mode 100644 index 00000000..a1666aad --- /dev/null +++ b/exampleSite/content/content/simple-alert.md @@ -0,0 +1,17 @@ +--- +authors: ["will-faught"] +categories: ["content", "paige"] +description: "A simple alert." +paige: + alert: "Get more information here." +tags: ["alerts"] +title: "Simple Alert" +weight: 60 +--- + +This page has the following parameters: + +```yaml +paige: + alert: "Get more information here." +``` diff --git a/layouts/_default/paige/home.html b/layouts/_default/paige/home.html index 41db6b48..94fcb0c9 100644 --- a/layouts/_default/paige/home.html +++ b/layouts/_default/paige/home.html @@ -45,6 +45,7 @@ {{ end }} {{ partial "paige/toc.html" $page }} + {{ partial "paige/alert.html" $page }} {{ partial "paige/content.html" $page }} {{ if $page.Param "paige.social" }} diff --git a/layouts/partials/paige/alert.html b/layouts/partials/paige/alert.html new file mode 100644 index 00000000..76254397 --- /dev/null +++ b/layouts/partials/paige/alert.html @@ -0,0 +1,9 @@ +{{ $page := . }} + +{{ with $page.Param "paige.alert" }} + {{ if reflect.IsMap . }} + + {{ else }} + + {{ end }} +{{ end }} diff --git a/layouts/partials/paige/article.html b/layouts/partials/paige/article.html index 8f4e0155..3fb4d391 100644 --- a/layouts/partials/paige/article.html +++ b/layouts/partials/paige/article.html @@ -55,6 +55,7 @@
{{ partial "paige/metadata.html" $params }} + {{ partial "paige/alert.html" $page }} {{ partial "paige/toc.html" $params }} {{ partial "paige/content.html" $params }}