Skip to content

Widget

Widget Page

The Blacks template includes a promotion widget — a small block of content that appears on every article page across your site. Use it to highlight a service, feature a product, or promote a related post.

This is different from regular pages. You write it once, and it shows up everywhere.


Where Widgets Live

All promotion widgets live inside:

src/content/services/

Each Markdown file in this folder becomes a promotion widget. You can have one, or many — the template decides how to display them based on your setup.


Create a New Promotion Widget

To create a new widget:

  1. Copy an existing Markdown file from src/content/services/
  2. Rename it to match your service or promotion name
  3. Open it in your code editor
  4. Update the frontmatter and content
  5. Save it

The widget will automatically appear on article pages.


Frontmatter Format

Every promotion widget starts with a block of frontmatter — the section between the --- markers at the top of the file.

Frontmatter format:

---
title: Title promotion widget
link: URL Link for promotion widget
description: Description promotion widget
image: URL image here...
pubDate: input publish date
---

What each field does:

FieldPurpose
titleThe widget’s display title
linkThe URL the widget points to (relative or absolute)
descriptionA short summary shown under the title
imageThe widget’s cover image
pubDateThe publication date. Format: YYYY-MM-DD.

Full Implementation Example

Here is a complete promotion widget ready to use:

---
title: Fashion Photography
link: fashion
description: Capture your moment with fashion photography art.
image: https://1.bp.blogspot.com/-WIXTfosQAto/YLd14DRL3iI/AAAAAAAAObM/yfqhdR62D_0NdLNvYsMV7Q9G8HFvWLpKwCLcBGAsYHQ/s2048/12890962_10206146031830731_8653409357574200403_o.jpg
pubDate: 2023-11-28
---

Output — Widget view:

Astro JS widget promotion

Output — Full article page with widget:

Astro JS widget promotion


Tips for Using Promotion Widgets

  1. Keep the title short. Two to four words work best.
  2. Write a benefit-driven description. Not “Fashion Photography” — instead “Capture your moment with fashion photography art.”
  3. Use a compelling image. This is the first thing readers see.
  4. Point to something relevant. If the widget appears on a photography post, link to a photography service.
  5. Update regularly. A stale promotion widget loses impact. Rotate it every few weeks.

Common Mistakes

MistakeResultFix
Missing linkWidget has no clickable targetAdd a link field
Missing imageWidget renders without a visualAdd an image field with a valid URL
Inconsistent pubDate formatSorting issuesUse YYYY-MM-DD
Broken image URLEmpty image blockTest the URL in your browser first

Next Step

Your promotion widget is ready. Continue to:

👉 Github Repo — push your project to GitHub for deployment