This is the official website for CADS, containing information about CADS and also a blog with weekly blog posts. The website is located at cadscheme.co.uk.
For the CADS website, we have chosen to use Hexo which is a static site generator which takes templates and posts and combines them into HTML which can then be statically served. This means that we don't have to worry much about hosting because we can very easily host static files on Netlify (which is the one that we are using at the moment) or GitHub Pages and have the website automatically redeploy once changes are made. This means that we don't have to have people constantly maintaining the website by redeploying it to a server.
This also complicated things for people who don't know how to use Git, Markdown and all of the other technologies that we use. For this reason, we have setup a tool called Forestry which allows people to login to an admin page and write articles in a user-friendly way which behind the scenes seamlessly hook into the workflow that we have already setup with Git and Netlify.
These instructions help you to setup an environment for you to contribute to the website by editing the code directly (not through Forestry). If you are doing this, you want to have a good understanding of how to use Git.
- Install the Hexo CLI:
This installs all of the tools you need for building and running the website on your computer.
yarn global add hexo-cli
- Install the project dependencies:
This installs all of the extra dependencies that are required for running the website.
yarn install
hexo new post <name>
- creates a new blog post in thesource/_posts
directory using a template.hexo new page <name>
- creates a new page in thesource
directory using a template.
We have a couple of extra scripts that are useful when working with the website:
- Running tests. Before committing, you should run tests on your computer which will check the code for spelling mistakes and other problems. Use the command
yarn run test
. - Running a development server. You might also want to run a local version of the website with your changes. Use the command
yarn run preview
and open your browser to http://localhost:8080/.
scaffolds
- this contains the templates which are used when runninghexo new post <name>
orhexo new page <name>
. You probably won't need to edit these.source
- this contains all of the 'raw' content such as pages and posts. Posts are stored in the_posts
folder and pages are stored just in thesource
folder in a directory with the same name.themes/cads
- this contains all of the templates that the content is injected into.layout
contains all of the EJS templates which is rendered into HTML.partials
contain small snippets that are reused oftensidebar
contains the widgets that are shown on the sidebarlayout.ejs
is the main template which contains the<html><head><body>
tags
scripts
contains custom code that is run before rendering the pages. We have one that gets the commit information for the footer.source
contains static files that don't need to be rendered (e.g. logos, css, js, etc...)_config.yml
contains theme specific configuration. You need to update this file after adding pages to put them onto the navigation bar! Apart from that, this file is not used particularly as this is a custom theme.
_config.yml
contains site-wide configuration for Hexo. This probably doesn't need to be changed..spelling
contains a list of custom words that override the spell checker.