Create an about page
Sometimes you’ll have unique, one-off pages that don’t make sense as a Section. Unlike the content you might store in Globals, however, each page would need to live at its own URL. A Single is perfect for this.
Let’s create a Single for an “About” page that will include a headshot and bio.
We’ll want to start again with our fields. To keep things tidy, we’ll create a volume for storing generic images and add an Assets field that uses it. Rather than create a new field for the about page content this time, we’ll re-use the Matrix block we created earlier.
# Create an Asset Volume
First, let’s add a volume for generic images. We’ll probably need images later that we don’t want to confuse with other images meant specifically for blog posts.
- In the
assets
directory you created earlier, create a new subdirectory namedgeneral
. - Back in the Craft CMS control panel, navigate to Settings → Assets.
- Choose + New volume.
- Enter the name “General” and set the following:
- Assets in this volume have public URLs: on/enabled
- Base URL:
@web/assets/general
- File System Path:
@webroot/assets/general
- Save the Asset Volume.
# Create an Assets Field
Now let’s create a new Assets field for the about page image, telling it to limit available uploads to the new volume we just created.
- Navigate to Settings → Fields.
- Create a “Singles Fields” field group, then choose + New field.
- Create a field called “About Image” entering the following:
- Field Type: Assets
- Restrict uploads to a single folder?: checked/enabled
- Default Asset Location: General
- Restrict allowed file types?: checked/enabled
- Select Image to ensure content editors can only select files that are images
- Save the field.
# Create a Single
Now we can create the about page single:
- Navigate to Settings → Sections and choose + New section.
- Enter “About” for the section name.
- To make this new section a single, select “Single” from the Section Type dropdown menu. Notice that the Site Settings change to take a single URI rather than an Entry URI Format that would be required for a Section.
- Enter
about
for URI, and_singles/about
for Template. - Save this section.
We’ll follow the same process we did for the blog to add fields to our new about single:
- Navigate to Settings → Sections and choose Edit entry type to the right of the “About” single.
- Create a “Content” tab and drag the “About Image” and “Post Content” fields to it. (Notice we’re re-using the “Post Content” field we created for blog entries.)
- Save the entry type.
You could also follow the same steps to create a Single for the home page (checking the little home icon), and once more for the blog landing page. But we don’t need to worry about either of those right now.