Skip to content

Commit b2d30d0

Browse files
atiq-csdaveaglick
authored andcommitted
Simplify imageAttribution (supports both Markdown and RawHtml in one variable)
1 parent 1b01a86 commit b2d30d0

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ These can be set in front matter, a sidecar file, etc. (in addition to any of St
170170
- `Tags`: Tags for a blog post.
171171
- `Published`: The date a page or post was published.
172172
- `Image`: Path to an image for the page or post.
173-
- `ImageAttribution`: Raw HTML of copyright attribution for the image.
174-
- `ImageAttributionMarkdown`: Markdown of copyright attribution for the image (`ImageAttribution` will be used instead of this if it's defined, so make sure only `ImageAttributionMarkdown` is defined if you want to use it).
173+
- `ImageAttribution`: Markdown of copyright attribution for the image.
175174
- `ShowInNavbar`: Set to `false` to hide a static page in the top navigation bar.
176175
- `IsPost`: Set to `false` to exclude the file from the set of posts. This will also disable post styling like displaying tags in the header.
177176
- `IsPage`: Set to `false` to exclude the file from the set of static pages. This will also disable navigation bar linking.

input/_header.cshtml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
bool isPage = Document.GetBool("IsPage");
1818
var imageAttribution = Document.GetString("ImageAttribution", string.Empty);
1919
var hasImageAttribution = !string.IsNullOrEmpty(imageAttribution);
20-
var imageAttributionMarkdown = Document.GetString("ImageAttributionMarkdown", string.Empty);
21-
var hasImageAttributionMarkdown = !string.IsNullOrEmpty(imageAttributionMarkdown);
2220
}
2321
<header class="@mastheadClass" style="@mastheadStyle">
2422
<div class="container position-relative">
@@ -58,10 +56,6 @@
5856
</div>
5957
@if (hasImageAttribution)
6058
{
61-
<div class="image-attribution badge text-bg-secondary rounded-pill">@Html.Raw(imageAttribution)</div>
62-
}
63-
else if (hasImageAttributionMarkdown)
64-
{
65-
<div class="image-attribution badge text-bg-secondary rounded-pill"><?# Markdown ?>@Html.Raw(imageAttributionMarkdown)<?#/ Markdown ?></div>
59+
<div class="image-attribution badge text-bg-secondary rounded-pill"><?# Markdown ?>@Html.Raw(imageAttribution)<?#/ Markdown ?></div>
6660
}
6761
</header>

0 commit comments

Comments
 (0)