Customizing the Theme
Workflow for creating a custom SEFSC Theme for GitHub Pages Documentation Sites
Step 7: Customize the theme
These steps take place primarily in the theme repo created on the previous page but also reference (and modify) the template repo created earlier.
Quarto projects are configured using a _quarto.yml file; see the docs for more info. The new template repo contains this file already. The metadata sharing feature of Quarto allows that _quarto.yml file up to be split into multiple files. Quarto will combine them together again when the project is rendered. We will take advantage of this feature here.
Committing all changes at the end of each step below is strongly recommended, keeping in mind that some steps modify both the template and theme repos.
First, create a new file in the theme repo called
_website.ymland populate it with any website configuration settings from the template repo_quarto.ymlthat should be consistent across all documentation pages. These settings include:- Website page navaigation
- Repo actions
- Format settings
- Filter
Delete the relevant lines from the template repo
_quarto.ymland insert them into the theme repo_website.ymlfile.CautionFor any section that gets split up, be sure to replicate the section header in the new yaml file so that Quarto knows how to merge them. See the example that follows.
For example, the original template repo
_quarto.ymlfile contains:website: page-navigation: true title: "NOAA quarto simple" site-url: "https://nmfs-opensci.github.io/NOAA-quarto-simple-python" repo-url: "https://github.com/nmfs-opensci/NOAA-quarto-simple-python" repo-actions: [edit, source, issue] favicon: images/favicon.icoAfter completing this step, the new theme
_website.ymlfile should contain:website: page-navigation: true repo-actions: [edit, source, issue] favicon: images/favicon.icoleaving the following in
_quarto.yml:website: title: "NOAA quarto simple" site-url: "https://nmfs-opensci.github.io/NOAA-quarto-simple-python" repo-url: "https://github.com/nmfs-opensci/NOAA-quarto-simple-python"Note that both files contain a
website:section header.Take this a step further by creating a second file,
_metadata.yml, in the theme repo to contain the only site information that a user will need to set when creating a new documentation site. For now, the four website elements above (title,site-url, andrepo-url) are the only elements that need to be set for each project (this is the beauty of using Quarto for this application!) Remove this section from the template_quarto.ymlfile and insert them into the new theme repo_metadata.ymlfile.At this point,
_quarto.ymlshould no longer contain awebsitesection: it has been entirely distributed between_website.ymland_metadata.yml.Back in the theme repo
_website.ymlfile:- Add and configure a
page-footerto contain NOAA, Fisheries, and SEFSC contact information. - Configure the
sidebarwith NOAA and SEFSC information.
NoteSetting
contents: autoallows the sidebar to be automatically generated, eliminating the need for manual construction or configuration. Users should therefore follow the instructions in the docs for facilitating this feature.- Add and configure a
In the theme repo
theme.scssandtheme-dark.scssfiles:Assign NOAA-specific colors to variable names for easy use later. These colors were taken from the NOAA Fisheries Brand Standards and include NOAA primary colors, grays, and secondary colors for each region. For example:
// NOAA Fisheries Primary Palette $noaa-light-blue: #0093D0; $noaa-dark-blue: #0055A4; $navy-blue-pantone: #00467F;Set font colors:
// Font colors $headings-color: $navy-blue-pantone !default; $link-color: #216f9b !default;
Upload a new favicon image to the
imagesdirectory, if desired. If a different file name is used, modify_website.ymlaccordingly:website: ... favicon: path/to/new-favicon.icoCreate a new branch on the theme repo called
navbarsto be used for the top navigation bar of the documentation site.Command line:
git -b checkout navbarsOr on the repo’s GitHub website (be sure to run
git fetchlocally to retreive it)Create a new file on this branch,
_topnav_sefsc.yml.Add and configure a
navbarfor the website containing relevant resources and links. For example:website: navbar: background: $navy-blue-pantone search: true right: - text: "SEFSC Resources" menu: - href: https://www.fisheries.noaa.gov/contact/southeast-fisheries-science-center text: SEFSC Homepage - href: https://nmfs-opensci.github.io/ text: NOAA Fisheries Open Science - text: "Software & Documentation" menu: - href: https://github.com/sefsc text: SEFSC GitHub Organization - href: https://noaa-fisheries-integrated-toolbox.github.io/ text: NOAA Fisheries Integrated ToolboxCommit the changes to this branch, for example:
git add . git commit -m "Initial commit" git push origin navbars
Next we will tie all of this together.