Skip to content

Commit 049cc21

Browse files
committed
feat: Add image attribution for blog posts
Adds support for attributing banner images in blog posts. Includes front matter configuration, layout changes, and styling.
1 parent 5709af3 commit 049cc21

File tree

7 files changed

+48
-1
lines changed

7 files changed

+48
-1
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Adding new content is one of the best ways to contribute. We use Hugo's [archety
120120
```
121121
2. **Location:** `content/blog/your-post-title-slug/index.md`
122122
3. **Images:** Place images for the post inside the `content/blog/your-post-title-slug/` directory.
123-
4. **Front Matter:** Fill in the `title`, `description`, `author`, and `image` (for the banner).
123+
4. **Front Matter:** Fill in the `title`, `description`, `author`, and `image` (for the banner). Remember to add `image_attribution` if the banner image requires credit.
124124

125125
### Adding Events (Workshops, Student Talks, etc.)
126126

archetypes/blog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ date: {{ .Date }}
66
# Entice users to click by showing the value they'll get from reading.
77
description: "Engaging summary of this blog post, highlighting key insights or takeaways."
88
image: "your-banner-image.png" # Suggested: place banner (1200x630px) in this post's folder. Used for OG image.
9+
# Optional: Add image attribution for the banner image.
10+
# image_attribution:
11+
# text: "Photo by"
12+
# author: "Artist Name"
13+
# url: "https://link.to.source"
914
draft: true
1015
author:
1116
- "Your Name or Author Slug" # Match with a contributor profile title or slug (see project docs for format)

assets/scss/_typography-custom.scss

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,3 +275,32 @@ h1 a, h2 a, h3 a, h4 a, h5 a {
275275
color: #bcfbff;
276276
}
277277
}
278+
279+
.image-attribution-caption {
280+
// Positioning for the container div
281+
@apply text-right text-xs italic -mt-8 mb-4 pr-2 relative z-10;
282+
283+
.attribution-backdrop {
284+
// Styling for the text's background
285+
@apply inline-block px-2 py-1 rounded-md;
286+
background-color: rgba(0, 0, 0, 0.6); // Semi-transparent black
287+
backdrop-filter: blur(2px); // Optional: adds a nice blur effect on supported browsers
288+
color: white;
289+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); // Adds a subtle shadow for pop
290+
291+
// Link styling within the backdrop
292+
a {
293+
color: #bcfbff !important; // Bright, readable link color
294+
text-decoration: underline !important;
295+
text-underline-offset: 2px;
296+
transition: color 0.2s;
297+
298+
&:hover {
299+
color: #ffffff !important; // Brighten on hover
300+
}
301+
}
302+
}
303+
}
304+
305+
// NOTE: We no longer need a separate .dark rule for this,
306+
// as the dark semi-transparent background works well in both light and dark modes.

content/blog/strategic-vision-open-neuromorphic/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
title: "Strategic Vision for Open Neuromorphic"
33
description: "Why 'open' matters and where we want to take the Open Neuromorphic community"
44
image: stars.jpg
5+
image_attribution:
6+
text: "Photo by"
7+
author: "Casey Horner"
8+
url: "https://unsplash.com/photos/fireworks-pXZxuXmpsNo"
59
aliases:
610
- /blog/vision
711
draft: false

layouts/blog/single.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
{{ if $image }}
99
<div class="mb-6">
1010
{{ partial "image" (dict "Src" $image "Context" .Page "Alt" .Title "Class" "w-full rounded" "Size" "1280x720" "Command" "Crop") }}
11+
{{ partial "components/image-attribution.html" . }}
1112
</div>
1213
{{ end }}
1314
{{ partial "components/metadata-bar.html" (dict "context" . "type" "blog") }}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{ with .Params.image_attribution }}
2+
<div class="image-attribution-caption">
3+
<span class="attribution-backdrop">
4+
{{ .text | default "Image:" }} <a href="{{ .url }}" target="_blank" rel="noopener">{{ .author }}</a>
5+
</span>
6+
</div>
7+
{{ end }}

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This repository contains the source code for the official **Open Neuromorphic (O
1212
* **Resource Hubs:** Curated guides for [Neuromorphic Hardware](/neuromorphic-computing/hardware/) and [Software](/neuromorphic-computing/software/).
1313
* **Automated Deployments:** CI/CD pipeline using GitHub Actions for automated builds and deployments.
1414
* **Dynamic OG Images:** Automatically generated Open Graph images for better social sharing.
15+
* **Image Attribution:** Simple front matter configuration to give credit for banner images.
1516

1617
## 🚀 Getting Started: Running Locally
1718

0 commit comments

Comments
 (0)