Require alert config object

master
Will Faught 1 year ago
parent 46afb013bc
commit c495b5aab8

@ -298,7 +298,6 @@ Parameters specific to pages:
link = "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title link = "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title
[paige] [paige]
alert = "Alert!" # Markdown displayed before the page body (defaults to primary alert type)
pin = true # Display this page before the rest pin = true # Display this page before the rest
[paige.alert] [paige.alert]

@ -2,14 +2,14 @@
authors: ["will-faught"] authors: ["will-faught"]
categories: ["content", "paige"] categories: ["content", "paige"]
date: "2023-09-18T21:21:05-07:00" date: "2023-09-18T21:21:05-07:00"
description: "A complex alert." description: "An alert."
paige: paige:
alert: alert:
message: "Get more information <a href=\"#\" class=\"alert-link\">here</a>." message: "Get more information <a href=\"#\" class=\"alert-link\">here</a>."
type: "danger" type: "primary"
tags: ["alerts"] tags: ["alerts"]
title: "Complex Alert" title: "Alert"
weight: 70 weight: 60
--- ---
This page has the following parameters: This page has the following parameters:
@ -18,5 +18,5 @@ This page has the following parameters:
paige: paige:
alert: alert:
message: "Get more information <a href=\"#\" class=\"alert-link\">here</a>." message: "Get more information <a href=\"#\" class=\"alert-link\">here</a>."
type: "danger" type: "primary"
``` ```

@ -6,7 +6,7 @@ description: "A front matter link."
link: "https://willfaught.com/paige" link: "https://willfaught.com/paige"
tags: ["link"] tags: ["link"]
title: "Link" title: "Link"
weight: 80 weight: 70
--- ---
It takes you to the home page. It takes you to the home page.

@ -1,18 +0,0 @@
---
authors: ["will-faught"]
categories: ["content", "paige"]
date: "2023-09-18T21:33:35-07:00"
description: "A simple alert."
paige:
alert: "Get more information <a href=\"#\" class=\"alert-link\">here</a>."
tags: ["alerts"]
title: "Simple Alert"
weight: 60
---
This page has the following parameters:
```yaml
paige:
alert: "Get more information <a href=\"#\" class=\"alert-link\">here</a>."
```

@ -5,7 +5,7 @@ date: "2023-09-24T21:29:31-07:00"
description: "Only a video." description: "Only a video."
tags: ["video"] tags: ["video"]
title: "Video" title: "Video"
weight: 90 weight: 80
--- ---
{{< paige/youtube "dQw4w9WgXcQ" >}} {{< paige/youtube "dQw4w9WgXcQ" >}}

@ -1,9 +1,5 @@
{{ $page := . }} {{ $page := . }}
{{ with $page.Param "paige.alert" }} {{ with $page.Param "paige.alert" }}
{{ if reflect.IsMap . }}
<div class="alert alert-{{ .type }}" role="alert">{{ .message | markdownify }}</div> <div class="alert alert-{{ .type }}" role="alert">{{ .message | markdownify }}</div>
{{ else }}
<div class="alert alert-primary" role="alert">{{ . | markdownify }}</div>
{{ end }}
{{ end }} {{ end }}

Loading…
Cancel
Save