Skip to content

Commit a651d7c

Browse files
authored
archetypes: Add more stock layouts for new content (#125)
By leveraging archetypes, we can make it quicker and easier for contributors to create new content on the website. The readme has also been edited to better document how to create new content; the old text only went over blog posts, and not in a good step-by-step way. Signed-off-by: Evan Maddock <maddock.evan@vivaldi.net>
1 parent 4356541 commit a651d7c

4 files changed

Lines changed: 65 additions & 35 deletions

File tree

README.md

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,55 @@ Static, [Hugo-based](https://gohugo.io) home of Solus and its projects. This web
88

99
## Creation
1010

11-
### New Post
12-
13-
To create a new post, change to the main directory of this repo (solus-site.github.io).
14-
From there, call `hugo new PATH`. The `PATH` format is `blog/year/month/post-title/index.md`.
15-
16-
For instance, to create a blog post for Feb. 2023 with the name "Welcome To The New Site", you would use: `hugo new blog/2023/02/welcome-to-the-new-site/index.md`.
17-
This would create `content/blog/2023/02/welcome-to-the-new-site/index.md`.
18-
19-
The markdown file will be created with our default configuration, which you can update as necessary. For metadata, most fields are self-explanatory.
20-
21-
- "name" - should match the name for your data file under `data/team/name.yml` (required)
22-
- "featuredimage" - a relative link to an image such as "/image.png" (optional)
23-
- "categories" is set to "news" by default. You can optionally add others.
24-
25-
Any featured image file must be in the same directory as the blog post.
11+
To make page creation easier, we have some page archetypes that can be used to get started quickly.
12+
13+
### New content page
14+
15+
Regular page content, e.g. non-blog posts, can be written in two different formats: Markdown, and HTML. Markdown pages are quicker and easier to create, but lack the flexibility that comes with writing HTML. Think about how you want the page to look, and choose which format to use based on the page's design.
16+
17+
#### Markdown page
18+
19+
1. Change to the main directory of this repository.
20+
2. Run `hugo new` to create the basic page structure.
21+
```bash
22+
hugo new --kind markdownpage content/pagename.md
23+
```
24+
3. Write the page content as Markdown.
25+
26+
#### HTML page
27+
28+
1. Change to the main directory of this repository.
29+
2. Run `hugo new` to create the basic page structure.
30+
```bash
31+
hugo new --kind htmlpage content/pagename.md
32+
```
33+
3. Write the page content using HTML.
34+
35+
We have several component shortcodes you can use to achieve a design that fits with the rest of the website. Some of these include:
36+
37+
- `section`
38+
- `link`
39+
- `button`
40+
- `bulletpoint`
41+
42+
### New blog post
43+
44+
1. Change to the main directory of this repository.
45+
2. Run `hugo new` to create the basic page structure. Replace the year, month, and title with real values in the example command below.
46+
```bash
47+
hugo new --kind blog content/blog/2026/01/my-blog-post/index.md
48+
```
49+
3. Edit the post's frontmatter as necessary. Most fields are self-explanatory.
50+
- `authors` - A list of people who authored the post.
51+
```yaml
52+
authors:
53+
- image: https://avatars.githubusercontent.com/u/5157277?v=4
54+
link: https://github.com/EbonJaeger
55+
name: Evan Maddock
56+
```
57+
- `tags` - A tags a post should have, e.g. `news`, `devlog`, `release`. Tags are free; use as many as you like!
58+
- `url` - The final URL of the blog post. `:year` and `:day` are placeholders that will automatically be filled in by Hugo during page generation, and should not need to be edited.
59+
4. Write the post content as Markdown.
2660

2761
### File and directory standards
2862

@@ -50,21 +84,6 @@ As an example, as of October, the directory for 2023 looks like:
5084
└── index.md
5185
```
5286

53-
Example of blog post metadata
54-
55-
```
56-
---
57-
title: "Solus 4.4 Released"
58-
author: "joshua"
59-
categories:
60-
- news
61-
- releases
62-
date: 2023-07-08T00:27:44+03:00
63-
featuredimage: "/solus-4.4-featured.jpg"
64-
url: "/2023/07/08/solus-4-4-released"
65-
---
66-
```
67-
6887
## Use caution before deleting files
6988

7089
Files in `static/imgs/release-images/` may be used outside of the website.

archetypes/blog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
authors:
3+
tags:
4+
- news
5+
date: '{{ time.Now.Format "2006-01-02" }}'
6+
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
7+
url: '/:year/:month/{{ replace .File.ContentBaseName "." "-" }}'
8+
---

archetypes/htmlpage.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
layout: solus
3+
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
4+
toc: false
5+
---
6+
7+
{{< page-header title="{{ replace .File.ContentBaseName "-" " " | title }}" subtitle="" >}}
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
---
2-
authors:
3-
tags:
4-
- news
5-
date: '{{ .Date }}'
62
title: '{{ replace .File.ContentBaseName "-" " " | title }}'
7-
url:
3+
toc: false
84
---

0 commit comments

Comments
 (0)