Files
datacontroller.io/docs/adding-feed-posts.md
T
Unknown 8a10d127c1
publish / Build-and-publish (push) Successful in 13m32s
feat: feed feature, typescript, remove google, fix errs & warns
2026-07-17 22:22:29 +01:00

97 lines
4.2 KiB
Markdown

# Adding a Feed Post
The **Feed** section (`/feed/`) is for short announcements and social-media
style updates — things that don't warrant a full [`content/blog/`](../content/blog)
article, but are still worth publishing and syndicating via RSS.
Feed posts work exactly like blog posts (one markdown file per post, in its
own directory), but live under `content/feed/` instead of `content/blog/`,
and are published under `/feed/` instead of `/blog/`.
Both sections share a single combined RSS feed at
[`/rss.xml`](https://datacontroller.io/rss.xml) (see `gatsby-plugin-feed` in
[`gatsby-config.js`](../gatsby-config.js)), so a new Feed post automatically
appears in the RSS feed the next time the site is built — no extra
configuration required.
A visible "RSS Feed" link (pointing to `/rss.xml`) is rendered in two places
so visitors can discover and subscribe to it:
- The site-wide [`Footer`](../src/components/footer/index.tsx), under
"Other Resources".
- The "Subscribe" section of the shared
[`SideBar`](../src/templates/sidebar.tsx), shown on Blog and Feed list/post
pages.
## 1. Create a new post directory
Create a new folder under `content/feed/`, named after the post slug (this
becomes the URL):
```
content/feed/my-new-announcement/index.md
```
## 2. Write the frontmatter + content
```md
---
title: 'My New Announcement'
description: A one or two sentence summary used for SEO and RSS.
date: '2024-06-01 09:00:00'
author: 'Your Name'
authorLink: https://www.linkedin.com/in/yourprofile/
tags:
- Announcements
---
Your announcement content goes here, written in regular Markdown.
```
Notes on frontmatter fields:
| Field | Required | Notes |
| ------------- | -------- | ---------------------------------------------------------------------- |
| `title` | Yes | Post title, used on the page, in the sidebar and in the RSS item. |
| `description` | Yes | Short summary, used for SEO meta tags and the RSS item description. |
| `date` | Yes | Format `'YYYY-MM-DD HH:MM:SS'`. Controls sort order and the archive. |
| `author` | Yes | Displayed under the post title. |
| `authorLink` | No | If set, the author name links out (e.g. to a LinkedIn profile). |
| `tags` | Yes | One or more tags. Used for the sidebar category list and RSS `<category>`. |
| `previewImg` | No | Optional relative path to an image in the same folder (e.g. `'./cover.png'`). Feed posts commonly omit this since they're short-form. |
## 3. Add any images (optional)
If you use `previewImg` or reference images in the body, place the image
files in the same post directory and reference them with a relative path,
the same as for blog posts.
## 4. Build / preview
```shell
npm run develop
```
Your new post will be available at `/my-new-announcement/`, and will appear:
- On the [`/feed/`](https://datacontroller.io/feed/) listing page (with
pagination, sidebar archives and tag categories under `/feed/...`).
- In the site search index.
- In the combined RSS feed at `/rss.xml`, alongside blog posts.
## How it differs from a Blog post
| Aspect | Blog | Feed |
| ------------------ | ------------------------------ | ----------------------------------- |
| Content directory | `content/blog/` | `content/feed/` |
| Listing page | `/blog/` | `/feed/` |
| Year archive | `/{year}/` | `/feed/{year}/` |
| Category page | `/category/{tag}/` | `/feed/category/{tag}/` |
| Template | `src/templates/blog-post.tsx`, `src/templates/blog-list.tsx` | `src/templates/feed-post.tsx`, `src/templates/feed-list.tsx` |
| RSS | Included in `/rss.xml` | Included in `/rss.xml` |
Feed archive/category routes are prefixed with `/feed/` specifically to avoid
colliding with the equivalent Blog routes, since both content types are
rendered by the shared [`src/templates/sidebar.tsx`](../src/templates/sidebar.tsx)
component (via its `basePath` prop).