How this site is generated
- Source Location
- Deploying changes
- Reset environment
- Jekyll can be run with Ruby 2.5.0 or higher.
- Development
- Deployment
This website is generated using the Jekyll static site generator with the Just the Docs theme.
Source Location
This site is developed and built from {site.local_path}. It is a Git repository that syncs to <{site.git_url}>.
Deploying changes
After making changes in the source location, log in to smaug and run the deploy.sh script. This will use a Ruby installation present on the /scratch drive of smaug and the bundle command to rebuild the website and copy its contents to <{site.url}{site.baseurl}>.
Reset environment
If the source location is destroyed, it may be recreated by doing the following:
git clone {site.git_url}
Installing Ruby, Bundle, Jekyll
-
Jekyll can be run with Ruby 2.5.0 or higher.
- I use
rbenvinstalled in my home folder to run Ruby 3.2.2, but this shouldn’t be necessary. (I had to install some dependencies to build Ruby 3.2.2 withrbenv, likelibyaml-devel) - RubyGems is also required (and comes with any Ruby installation from
rbenv). -
The only thing you have to install with
gemis Bundler, which provides a way to set up an isolated environment of Ruby packages.gem install bundler -
Then to install everything needed to build the site, from the source directory, just run
bundle installThis will create the
vendorandbinfolders with jekyll and all the required dependencies downloaded and ready to run. - To add other software (e.g. Jekyll plugins) to the bundle, either use
bundle add <GEM_NAME>, or manually add a gem dependency line toGemfileand then runbundle update.
Development
Admin/User
- There are actually two separate sites, the admin and user sites for storing their respective documention. This was done due to Just the Docs only having three levels of navigation depth and fairly different content for the admin and users. This is done in such a way that most of the configuration files for the two sites are shared. Specifically:
user/.bundle/configis a symlink toadmin/.bundle/config. That file sets the base locations for thevendorandbindirectories to the root of the repository so both sites use the same Ruby stuff.user/Gemfileanduser/Gemfile.lockare both symlinks to files of the same name underadminso both sites have the same gems installed (which is necessary anyway with the sharedvendorandbindirs)user/index.mdis a symlink toadmin/index.mdand has links to both sites, so it’s easy to get from one to the other.user/_sass/custom/custom.scssis a symlink to the same path underadminto keep styling consistent.index.htmlredirects touser/admin.html
- The page content for each subsite is located in the
docsfolder, and consists of various Markdown files.- To add a new page, create a markdown file somewhere in the
docsfolder. -
At the top of every page should be a section of YAML front matter that includes, at a minimum, a
titleattribute, and typically aparentattribute as well. For example, the front matter for the page atdocs/admin/logs/2022_system_setup_01.mdis:--- title: CIL Admin Logs - part 1 parent: CIL Admin Logs ---The
parentattribute is thetitleof the page to nest this page under in the navigation. In addition, a page may havehas_children: Trueto indicate that it may have child pages in the navigation. A page at the tertiary level also requires thegrand_parentattribute. See the Just the Docs documentation for more info. -
To add a table of the contents to the page, include the following markdown at the top of the page:
- TOC {:toc}To make the TOC hideable, use the following:
<details open markdown="block"> <summary> Table of contents </summary> {: .text-delta } - TOC {:toc} </details>- This GitHub gist has good info on how to use the
<details>and<summary>HTML tags to create collapsible sections in Markdown.
- This GitHub gist has good info on how to use the
- To number the headings, add
numbered-headings: Trueto the front matter. Note that there is a bug that causes Jekyll to add the numbers to the heading’s HTMLidattribute, so to link to a heading without needing to predetermine the heading number you have to manually add an anchor to the heading, as shown in this jekyll-numbered-heading issue. -
To link to an attachment or include an image, put the file in the
./assets/attachor.assets/imagesdir as appropriate, then in the markdown file use the Liquid syntaxoras the base dir for the file. For example, the imagePuTYY1.pngis included in thedocs/user/ssh/index.mdfile with the following syntax:") - These directories and other Jekyll and Just-the-Docs configuration parameters are defined in the
_config.ymlfile.
- To add a new page, create a markdown file somewhere in the
Deployment
The deploy.sh script in the source repository does the following for each subsite:
- Converts spreadsheets to HTML
- Checks that changes have been committed to the repo
- Adds a commit string to the home page
- Runs
bundle exec jekyll buildto generate the website in the_sitedir - Copies the site to the web directory on the web server (balulu).
The directories and files in the web server’s /var/www tree are owned by the admin user (pittmara at the time of this writing) but with 644 permissions on all files and 755 permissions on all dirs. This ownership should be changed if someone else is managing the website.
To test website changes before commiting them to the git repo, either answer y at the prompt or run deploy.sh -y.