Table of Contents

Editing ubnetdef.org

How the heck do I put content on ubnetdef.org? What is hugo?! Can someone hold me while I cry?!

0. Installing Hugo

Hugo is the tool we use to build ubnetdef.org. All hugo does is take some static files, compiles them with our template, then output a bunch of html files.

Please follow the installation guide located here. After you install it, please read up more about hugo.

1. Installing git

We use git for version control, so you're going to need git.

You can use GitHub Desktop, or if you're feeling adventurous git-bash.

2. Clone the website repository

The website is located here. Clone it (which means “download”) to your local computer. As a note, now's a good time to ensure you have a GitHub account, and are added to the UBNetDef GitHub account.

Netdef Repo: https://github.com/ubnetdef/website.git

Lockdown Repo: https://github.com/ubnetdef/lockdown-website

Git Command:

git clone "REPO"

After cloning for the first time, there is no need to reclone the repo. To update your copy of the website to the most current version use the command git pull from a git CLI in the directory you previously created.

3. Make some changes

You're going to need a terminal open. Run hugo server inside the UBNetDef website directory you just cloned. Visit the URL it shows, and you should see all the changes you did show up automatically. Once your changes are completed, commit, then push them.

4. You're Done!

Once you push them to the GitHub repo, the website will auto-magically download the changes, and build it. Woah! It's magic.

Git commands:

git add -A

git committ -m "Change comments"

git push

Advanced

The hugo directory structure

How the building process works

/home/web-builder/webhooks/scripts/build_hugo_website.sh
#!/usr/bin/env bash
 
## USER CONFIG
WEBSITE=$1
## /USER CONFIG
 
cd ~/repos/$WEBSITE
git fetch origin > /dev/null
git reset --hard origin/master > /dev/null
 
echo "Building $WEBSITE..."
 
echo "-----"
~/bin/hugo
echo "-----"
 
# Update the the files
rsync -crlpgoDi --delete public/* /web/$WEBSITE/public | while read unused filename; do
  echo "Updated $filename"
done
 
# Fix the group
chgrp -hRf web-admins /web/$WEBSITE/public
 
# Make all files group writable
find /web/$WEBSITE/public -type f -exec chmod 664 {} \;
 
echo "$WEBSITE has been built and deployed!"