Pages reference
Overview
A content-type is a template for generating new content. The content-type configuration file provides a system for generating content files with the necessary template data properties for a given layout.
Introduction
Websites are collections of web pages.
Most websites have many different types of pages.
Different types of pages will generally also have different layouts and URL paths (e.g. /posts/:slug
vs /features/:slug
).
And not every page needs a title, description, or attachments (images, videos, audio, or files).
Keeping track of these differences is where content types really shine.
Example
In the HyperTexting CMS, content types are like templates for generating specific types of pages. For example, if someone wanted to build a personal website using HyperTemplates, they could use content types to replicate the various types of pages they might otherwise use social media for:
- A video post needs a video attachment (e.g. @youtube.com or @tiktok.com videos)
- A photo/gallery post needs photo attachments (e.g. @instagram.com posts)
- A long-form blog post needs a title and description (e.g. @medium.com posts)
- An untitled post only needs content (e.g.
tweets@bsky.app, @threads.com, or @x.com posts)
Here's an example content type for publishing blog posts:
1---
2metadata:
3 name: Blog Post
4 description: Long-form editorial content.
5 icon: append.page
6 action: Publish Blog Post
7spec:
8 layout: post.html
9 format: markdown
10 path: /blog/
11 auto_slug: title-kabob
12 requires:
13 title: true
14 content: true
15 template:
16 content-type: page
17 foo: bar
18prompts:
19 - name: page
20 required: true
21 inputs:
22 title: {}
23 description: {}
24patches: [] # coming soon
This content type requires a title and some content.
A new page created with this content type and the title "Hello World" would result in a new page data file created at content/blog/hello-world/index.md
.
Properties
Content types are configured using four top-level properties:
Metadata
metadata.name
- The content type name (required).
The value presented to users when selecting a content type in HyperTexting CMS applications.
Example
1metadata: 2 title: Quick Post
metadata.description
- The content type description (required).
A short summary of the content type's intended purpose or characteristics.
Example
1metadata: 2 description: Like a tweet, but without the arbitrary character limit.
metadata.icon
- The content type icon (optional).
Supported values are any SF Symbols icon name (string), or a single emoji character.
Default
1metadata: 2 icon: 👻
The 👻 emoji is highly recommended for content types that generate disappearing pages. 🤌🏽
Spec
spec.layout
- The layout for pages generated using this content type (optional).
If
contenttype.spec.layout
is provided, it will be used to set thepage.layout
property of pages created using this content type.Example
1spec: 2 layout: post.html
spec.format
- The file format that should be used to create page index files.
The supported formats are:
markdown
: createindex.md
files (default)yaml
oryml
: createindex.yaml
filesjson
: createindex.json
files
spec.path
- The path prefix for pages created using this content type.
Example
1spec: 2 path: /blog/
spec.auto_slug
- The path slug format for pages created using this content type.
Example
1spec: 2 auto_slug: title-kabob
The supported slug
spec.auto_slug
formats are:timestamp
: the current time in milliseconds since epoch (seeDate.now()
)title-kabob
: thepage.title
in Kabob casetitle_camel
: thepage.title
in Snake casemanual
: a slug should be provided by the useruuid
: a UUIDv4 (e.g.2ad660a0-1df1-42c3-bf56-bf97539837d8
)none
: no slug (usesspec.path
as the page path)
In all cases except
auto_slug: none
, the computed slug is appended to thepath
.What is a slug? 🐌
In the HyperTexting CMS, a page "slug" is the last path component of a page URL. To illustrate, consider the following example URL:
1https://apple.com/hotnews/thoughts-on-flash # the url 2 /hotnews/thoughts-on-flash # the path 3 thoughts-on-flash # the slug
In this example we're dissecting a URL. Line 1 shows the complete URL. Line 2 shows the URL path. Line 3 shows the URL slug – the portion of the URL after the last
/
slash. spec.requires
- Required page elements.
Example
1spec: 2 title: true 3 content: true 4 attachment: link 5 redirect: false
There are four configurable requirements available at this time:
spec.requires.title
(boolean):page.title
must be providedspec.requires.content
(boolean):page.content
must be providedspec.requires.attachment
(string): an attachment of this kind is requiredspec.requires.redirect
(bool):page.redirect
must be provided
spec.template
- Default template data for new pages created with this content type.
Example
1spec: 2 template: 3 tags: [blog] 4 foo: bar
Use the
spec.template
property to provide default template data properties for pages created from this content type.
Prompts
🚧 Coming soon... 🚧
Patches
🚧 Coming soon... 🚧