This project welcomes contributions in the form of issues and pull requests from anyone. However, before you submit anything, please read the guidelines below to ensure you understand how to use this repo, and that your contributions meet this projects standards.
This site uses Hugo Static Site generation to render mark down into the static HTML pages that make up the site.
Please find documentation for using hugo here: https://gohugo.io/documentation/
Some guidance is provided for where to find each component of the site and how they work is detailed below:
The markdown files that determine the content of the pages can be found in /content. These are converted into the
static html pages but are not automatically added to the navbar, you can find that in navbar below.
List pages are pages that have lots of "articles" that are paginated. Currently, the site only has one list page: the News Page. More information can be found in news below.
These work slightly differently from regular pages. To create one, create a folder with the intended html name in
content, then create an _index.md file in that new directory. That _index.md file doesn't have to contain anything
other than front matter, but it does need to be there. Any content in that _index.md file will be displayed at the top
of each paginated page.
Posts for the list page can then be created by adding a subdirectory with any name, then adding to that subdirectory an
_index.md file with type = "posts" in the front matter.
For the Leicester Hackspace Theme, all the posts on the list page will be embedded onto the page, 5 at a time, instead of being linked to.
The navbar content is controlled with the /hugo.toml file. To add a new menu entry, add:
[[menus.main]]
name = 'PAGE NAME' # The name of the page that appears in the navbar
pageRef = '/PAGE PATH.html' # The path to the page, starting in the content directory
weight = 40 # The weight used to order the nav bar, these should just go in ascending for easeFor list pages, the pageRef is the name of the folder, with .html on the end still. For example, the news page's
pageRef is /news.html.
Archetypes are templates for new pages created through the command line. This site has a template for news posts.
In order to use an Archetype, you would use a command similar to the below:
hugo new intended/path/of/contentDepending on the path, hugo will use the archetype that matches the path, or use the default if no matches are found.
Archetypes can be found in /archetypes.
The Leicester Hackspace website uses a custom theme. This can be found in /themes/hackspace-theme.
The theme contains the majority of the html and styling of the site, except for some exception circumstances (which do not yet exist).
Layouts for the site can be found in /themes/hackspace-theme/layouts/_default. These are used to control the html of
the pages, where the markdown from Page Content replaces {{ .Content }}.
The baseof.html layout determines the main html layout. Home.html, List.html, and Single.html, determine the
body layout of the homepage, list pages, and all other pages, respectively.
These layouts use partials from /themes/hackspace-theme/layouts/partials. These partials are essentially reusable
snippets of html. Though they are mainly used for breaking down the content of the pages into manageable snippets.
Some shortcodes have been created in
/themes/hackspace-theme/layouts/shortcodes. These are small functions that can be called from markdown files to
produce some html. Their purposes are documented in the shortcode file.
Shortcodes can be called in markdown with the following syntax:
{{< SHORTCODE-NAME arg1 arg2... >}}where SHORTCODE-NAME is the name of the shortcode file without the .html" extension.
An example usage of the icon shortcode would be
{{< icon fas-bars >}}This site uses sass/scss to help with styling. The majority of the site's styling can be found in
/themes/hackspace-theme/assets/sass/, with some specific site content being moved outside of the theme and into
/assets/sass/custom.scss.
The main style can be found in main.scss, with some content for specific page types (e.g list pages) or for specific
complex content (e.g. the nav) being split out into their own files and imported into main.scss.
Javascript for the theme can be found in /themes/hackspace-theme/assets/js/.
Some Font Awesome Icons are available at /themes/hackspace-theme/static/icons/.
TODO
- 2 space tabs
- 2 space tabs
- Avoid bootstrap style single use classes
- Readability over conciseness
- SVGs should be in a human-readable format
- When possible (e.g. for icons), colour should be set to
currentColorin order to allow styling with css
The news content page is a list page.
To create a new news post, please use the following steps:
- Run the command
hugo new news/YYYY-M-topicwhich will generate the relevant folder and a _index.md file for you. It will use the predefined archetype found atarchetypes/news/_index.md- YYYY represents the relevant year. e.g.
2024 - M represents a month in text form, it is the first three letters. e.g.
jan - If in doubt, have a look at the existing names that are found in the
content/news/directory, and use them as a reference
- YYYY represents the relevant year. e.g.
- Update the date so that it is accurate to the relevant to the post. If possible, replace the time of the post with
00:00:00Z, as it will initially use the time of creation - Add content to the post, underneath the frontmatter (the
+++). Make sure to follow good markdown practices (markdown style guide)- If the post includes any images, videos, or other extra content, store them in the post directory
- Once happy with the content, remove the
draft = truesection from the frontmatter at the top of the document - Create a new branch from develop (e.g.
git checkout -b add-news-post)- 'add-news-post' should be swapped with a description fitting of the news post being added
- Run
git addon the files you have added (e.g.git add content/news/*) - Commit your changes to the new branch (e.g.
git commit -m "Add new news post")- Update the message that is in quotes to a description fitting of the news post being added
- Push your local branch to the remote repository (e.g.
git push origin add-news-post) - Create a pull request for the new branch
- Ensure the PR is reviewed by at least one other person, preferably 2, to ensure the post is up to standards.
When modifying an existing post, please use the following steps:
- Make you're changes to the post
- Add a
LastModentry to the frontmatter value for the current date and time - Commit the change to a new branch
- Make a pull request (Get it reviewed, etc)
This project has a couple of dependencies that must be setup before it can be used:
To run the site locally use:
hugo server -DThis will host a local webserver with the site's content.
To generate the static site content, run:
hugoThis will output the static HTML into /public.
Releases are performed automatically, using github actions.
The basic release process is:
- Build the site