Skip to content

Commit d0eb5ed

Browse files
docs: update doc to mention how to use frontmatter and thumbnails in blog posts
1 parent 455cc57 commit d0eb5ed

File tree

2 files changed

+75
-2
lines changed

2 files changed

+75
-2
lines changed

afterpython/doc/concepts.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ url = "https://your-company.com"
4141

4242
[website]
4343
url = "https://your-project-website.com"
44+
favicon = "favicon.svg"
45+
logo = "logo.svg"
46+
logo_dark = "logo.svg"
47+
thumbnail = "thumbnail.png"
4448
```
4549

4650
---

afterpython/doc/project_website.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,78 @@ For example, to change the landing page, which by default displays the `README.m
7474
All static files (e.g. `logo.svg`, `favicon.svg`, images, css files, etc.) should be put in the `afterpython/static/` directory.
7575
They will be automatically copied to the `afterpython/_website/static/` directory during `ap build`.
7676

77+
#### Content-Type-Specific Static Files
78+
In addition to the global `afterpython/static/` directory, each content type can have its own `static/` folder for content-specific assets:
79+
80+
- `afterpython/blog/static/` - Static files specific to blog posts (e.g., thumbnail images, blog-specific graphics)
81+
- `afterpython/tutorial/static/` - Static files specific to tutorials
82+
- `afterpython/doc/static/` - Static files specific to documentation
83+
84+
This organization helps keep content-related assets close to their source files. For example, if you have thumbnail images for your blog posts, place them in `afterpython/blog/static/` rather than mixing them with global assets in `afterpython/static/`.
85+
86+
---
87+
## Content Type Configuration
88+
Each content type (blog, tutorial, etc.) has a listing page that displays all posts of that type. You can customize these listing pages in `afterpython.toml`.
89+
90+
:::{note}
91+
This configuration applies to all non-doc content types. Documentation (`doc`) does not have a listing page, so these settings don't apply to it.
92+
:::
93+
94+
### Default Thumbnails
95+
Set a default thumbnail image for all posts within a content type:
96+
97+
```toml
98+
[website.blog]
99+
thumbnail = "blog_default_thumbnail.png"
100+
```
101+
102+
The thumbnail path is **relative to the content type's static folder**. In this example, `afterpython` will look for `afterpython/blog/static/blog_default_thumbnail.png`.
103+
104+
This default thumbnail will be used for any blog post that doesn't specify its own thumbnail.
105+
106+
:::{tip} Override Thumbnails Per Post
107+
You can override the default thumbnail for individual posts using MyST [frontmatter](https://mystmd.org/guide/frontmatter#available-frontmatter-fields). Add this to the top of your markdown file:
108+
109+
```markdown
110+
---
111+
title: My Blog Post Title
112+
description: A brief description of this post
113+
thumbnail: custom_thumbnail.png # Specific thumbnail for this post
114+
---
115+
```
116+
117+
This also works for Jupyter Notebooks - just add the frontmatter in the first cell as markdown.
118+
:::
119+
120+
### Featured Post
121+
Specify which post appears in the featured/hero section of the listing page:
122+
123+
```toml
124+
[website.blog]
125+
featured_post = "blog1.md"
126+
```
127+
128+
This will display `blog1.md` prominently in the hero section when users visit the blog listing page.
129+
130+
### Example Configuration
131+
Here's a complete example for blog posts:
132+
133+
```toml
134+
[website.blog]
135+
thumbnail = "blog_default_thumbnail.png" # Default thumbnail for all blog posts
136+
featured_post = "announcing-v1.md" # Featured post in hero section
137+
```
138+
139+
The same configuration works for other content types:
140+
141+
```toml
142+
[website.tutorial]
143+
thumbnail = "tutorial_default_thumbnail.png"
144+
featured_post = "getting-started.md"
145+
```
146+
77147
---
78-
## Work in Progress 🚧
79-
## Built-in Features
148+
## 🚧 Built-in Features
80149
- full-text search using [PageFind]
81150
- AI chatbot using [WebLLM]
82151

0 commit comments

Comments
 (0)