| Staging URL | Production URL |
|---|---|
| https://staging.learning.rc.virginia.edu | https://www.learning.rc.virginia.edu |
- Install the HUGO binary on your local computer. This has been tested with version 0.74.x-extended. You need the extended version. Binaries for different operating systems can be downloaded from the Hugo GitHub repo: https://github.com/gohugoio/hugo/releases/tag/v0.74.3.
- Clone this website repository:
git clone [email protected]:uvarc/rc-learning.git. Themasterbranch is protected. New content has to be pushed to thestagingbranch. Use this command to clone the staging branch only:git clone --single-branch -b staging [email protected]:uvarc/rc-learning.git.
The TL;DR version:
- Make your changes to the
stagingbranch and be sure to preview locally before you push back to GitHub. - All website pages are stored within
/content/ - You can use Markdown or HTML (or a mix of both) within pages.
Content of this website is contained in a series of markdown files within the content/ subdirectory. The site hierarchy consists of 7 subsections:
authors- Mission statement and staff directory.courses- short courses with multi-chapter content, e.g. Summer Education Seriesnotes- Contains all markdown files for workshops, courses, or tutorialsslides- Markdown doc will be rendered as slidestutorials- self-paced material not associated with particular workshop.videos- unused at the moment.workshops- Systems and information we support: Rivanna, Ivy, Skyline, etc., and detailed user information.
- Copy an existing page and modify it.
- Create a new page using the
hugo newcommand declaring a path to the .md object you want to create:
hugo new post/here-is-my-post.mdhugo new top-level-page.md
- The "content type" of a page is usually determined by what folder it is in. Different content types are displayed in slightly different ways, i.e. the sidebar or layout.
- Reference: markdown cheatsheet
- Store images in
static/images/. For example, the published URL ofstatic/images/uva-logo.jpgwill be https://www.rc.virginia.edu/images/uva-logo.jpg - Follow guidelines from https://gohugo.io/content/organization/.
Metadata for each web page is contained in YAML format at the top of each markdown page. The only required fields are usually TITLE and DATE. Categories and Tags can be as numerous as you find useful.
title: my workshop draft: false type: article toc: true
Using the date metadata smartly, you can forward date any post or article. Automated builds happen each morning and your page will be published when that datetime has passed.
hugo server will bring up the local hugo server and give you a preview URL http://localhost:1313/. If making many changes, open another terminal to keep the hugo server running as you edit.
Simply push staging back to GitHub. We're in the process of setting up the S3 buckets for hosting the content.
TravisCI will handle it from there and publish the content at the staging site, https://staging.learning.rc.virginia.edu. Pushing your content to the production website requires a PULL REQUEST.
Remember that after pushing your changes back to the
stagingbranch, the https://staging.rc.virginia.edu/ website will be updated within 1-2 minutes. Hold down the SHIFT key when reloading your browser to refresh your local cache.
- Delete the .md object(s) you no longer want in the site, then commit and push.
- To temporarily remove content, set the
draftstatus of any .md object totrue. - Republishing deletes remote files in S3/CloudFront.
Travis-CI is a CI/CD tool that automates builds and deployments of the website code. Take note of the contents of .travis.yml and you will see instructions for how Travis builds the site:
- Upon a push to
stagingormasterit launches a customized containeruvarc/hugo-build:v2. - That container runs a script that clones that branch of the repository and runs
hugo -v --ignoreCacheto build the site. - Travis then synchronizes the published HTML, JS, CSS, images and files to Amazon S3.
- Finally, the build invalidates the CloudFront cache that serves out the actual website.
Build+deployment generally takes 70 seconds and can be monitored using the Travis-CI dashboard for this repository.