A simple YAML/React based static site generator. Each YAML file in the content
directory will convert to an html file.
Please read this document thoroughly before committing/pushing any changes
- Git (https://git-scm.com)
- Node: Make sure you’ve installed the version of node indicated in the .nvmrc. You’re better off installing nvm (https://github.com/nvm-sh/nvm), so you can easily switch to the specific version of node needed and this project doesn’t lock you into the version needed for it. Once you’ve installed it, you’re ready to follow the instructions below.*
*This assumes you’re familiar with and comfortable using the command-line. If you’re not, then let someone who is complete the required work.
You should do this before making any yaml changes so you can see your changes live in the browser as you make them.
$ signifies system shell prompt. Not part of command.
$ nvm use
$ npm ci
$ npm run dev
End dev mode by typing control + c
(Mac) / ctrl + c
(PC).
This isn’t strictly necessary since it happens automatically in the pipeline when your branch is merged into master and a new deploy is kicked off.
However, it’s useful, if you’d like to serve it locally to verify your changes in a production build.
$ nvm use
$ npm ci
$ npm run build
Once you’ve got a production build, you can serve the site locally using the serve
script:
$ npm run serve
Each page’s YAML file requires a few key pieces which we’ll cover below. However, please read the following quick overview of what YAML is:
https://dev.to/paulasantamaria/introduction-to-yaml-125f
The following is the minimum needed for a new chart page:
---
meta:
title: 2020 CC Community Music Awards
heading: 2020 Nominees & Winners
description: The third annual CC Community Music Awards
content:
categories:
- name: Best Hip-Hop Album
nominees:
- artist: Some Artist
title: Some Album Title
url: https://somewebaddress.example
winner: true
You’ll notice above that there are two mandatory root keys in the file:
- meta
- content
You’ll also notice that some fields/keys begin with a -
. That indicates the start of a new item in an array. So above artist
is the first key of a nominee and winner
is the last. The next nominee would again begin with - artist: Another artist
.
At the minimum, the meta
object requires:
title
: Used for the page’s title tagheading
: Used for the page’s h1 tagdescription
: Used for the meta description
However, it can optionally include:
image
: Used for the social media / opengraph image meta tag.type
: Used to designate the page class. Options are none,previous
orarchive
. This simply changes the color scheme of the page.
The content
object requires one of the following. Both can be used, but there isn’t likely going to be a need for that use.
categories
: This is an array of… well… categoriesbody
: This is freeform html as is used forabout.yaml
andarchive.yaml
. Try not to use this, unless there’s a clear need for a new page that requires some freeform content. I’d argue that there should be a discussion before you go this route.
A category is made up of the following:
name
: The name of the award categoryregional
: Optional field indicating whether or not the category is a regional one. Defaults to false, so you only really need to include it if setting to true like soregional: true
.nominees
: An array of… yup, you guessed it… award nominees (including winners).
At minimum nominee is made up of the following:
artist
: The nominee’s artist nameurl
: The url to the album, track or official artist website (depending on what type of award)
The following optional fields are also supported:
title
: The nominee’s album, video or track title (generally required, except for regional awards)winner
: Only needed when the nominee is the winner. Set it like sowinner: true
.type
: Optional for regular album categories. Otherwise needed for track, video and regional categories. Valid values are:track
,video
,region
. This controls what aria-label is added to the external links.embedUrl
: Used for video nominees. A proper embed url for YouTube or Vimeo is required. You can get those from a video by clicking the video’s share button on the video’s page and choosing embed. In the provided html snippet, you want the iframe’ssrc
value.
Examples:
Don’t work directly on main
. Always create a new branch from main
for any work.
Follow the Conventional Commits Specification.
Adding a new content yaml file would be something like:
feat: Some add new yaml file commit message
Fixing something would require a commit like:
fix: Some commit message
Updating something that isn’t necessarily a bug fix or a feature would require a commit like:
update: Some commit message
A validation script is run on the YAML before you can complete your commit. Once you’ve successfully committed your work, push your branch up to the repo and open a PR for approval.