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
[paige]
alert = "Alert!" # Markdown displayed before the page body (defaults to primary alert type)
pin = true # Display this page before the rest
[paige.alert]

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

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

Loading…
Cancel
Save