Skip to content

Commit 004ddcf

Browse files
committed
docs: update blog post creation guide
1 parent 9f75d26 commit 004ddcf

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/data/blog/adding-new-post.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
author: Sat Naing
33
pubDatetime: 2022-09-23T15:22:00Z
4-
modDatetime: 2025-03-08T07:46:00.619Z
4+
modDatetime: 2025-03-17T17:41:19.776Z
55
title: Adding new posts in AstroPaper theme
66
slug: adding-new-posts-in-astropaper-theme
77
featured: true
@@ -15,8 +15,43 @@ description:
1515

1616
Here are some rules/recommendations, tips & ticks for creating new posts in AstroPaper blog theme.
1717

18+
<figure>
19+
<img
20+
src="https://images.pexels.com/photos/159618/still-life-school-retro-ink-159618.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1"
21+
alt="Free Classic wooden desk with writing materials, vintage clock, and a leather bag. Stock Photo"
22+
/>
23+
<figcaption class="text-center">
24+
Photo by <a href="https://www.pexels.com/photo/brown-wooden-desk-159618/">Pixabay</a>
25+
</figcaption>
26+
</figure>
27+
1828
## Table of contents
1929

30+
## Creating a Blog Post
31+
32+
To write a new blog post, create a markdown file inside the `src/data/blog/` directory.
33+
34+
> Prior to AstroPaper v5.1.0, all blog posts had to be in `src/data/blog/`, meaning you couldn't organize them into subdirectories.
35+
36+
Starting from AstroPaper v5.1.0, you can now organize blog posts into subdirectories, making it easier to manage your content.
37+
38+
For example, if you want to group posts under `2025`, you can place them in `src/data/blog/2025/`. This also affects the post URL, so `src/data/blog/2025/example-post.md` will be available at `/posts/2025/example-post`.
39+
40+
If you don’t want subdirectories to affect the post URL, just prefix the folder name with an underscore `_`.
41+
42+
```bash
43+
# Example: blog post structure and URLs
44+
src/data/blog/very-first-post.md -> mysite.com/posts/very-first-post
45+
src/data/blog/2025/example-post.md -> mysite.com/posts/2025/example-post
46+
src/data/blog/_2026/another-post.md -> mysite.com/posts/another-post
47+
src/data/blog/docs/_legacy/how-to.md -> mysite.com/docs/how-to
48+
src/data/blog/Example Dir/Dummy Post.md -> mysite.com/example-dir/dummy-post
49+
```
50+
51+
> 💡 Tip: You can override a blog post’s slug in the frontmatter as well. See the next section for more details.
52+
53+
If the subdirectory URL doesn’t appear in the build output, remove node_modules, reinstall packages, and then rebuild.
54+
2055
## Frontmatter
2156

2257
Frontmatter is the main place to store some important information about the blog post (article). Frontmatter lies at the top of the article and is written in YAML format. Read more about frontmatter and its usage in [astro documentation](https://docs.astro.build/en/guides/markdown-content/).

0 commit comments

Comments
 (0)