Useful resources:
Getting started with Hugo: https://www.youtube.com/watch?v=hjD9jTi_DQ4 Markdown cheat sheet: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet Yml documentation to understand syntax
Preparing your mac
Brew.sh Go Git Hugo Visual studio code Netlify Fathom
- Install homebrew -
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew -v
to see if it’s already installed - Install git
- Install visual studio code, then open explorer and look for “Shell Command: Install ‘code’ command in PATH select.
- Install hugo -
brew install hugo
Steps to creating the site
- Create Hugo site
- cd into desired location
- Create the new site with Hugo in terminal: hugo new site {site name} -f yml
- Pick or create a theme and upload into the site’s themes folder with git clone (if picking, check docs to learn theme’s capabilities - e.g. papermod): git clone https://github.com/adityatelange/hugo-PaperMod themes/PaperMod –depth=1 Update config file - copy and tweak from previous.
- Test: Hugo server, then go to localhost:1313 in browser
- Add posts to the content folder: hugo new posts/{postname}.md (or copy generated files from smartsheet)
- Add pages: top level add straight into content, index.html goes into layouts with an index.md file in content.
- Add images: site file > static > img > {paste} Editing theme: Copy exact folder structure for desired page in themes, copy to same on main site.
Publishing
- Create git repo with site files - cd into folder then: git init
- Create gitmodules file: touch .gitmodules (copy/tweak another gitmodules)
- Sign into github through vscode, commit changes to public (cmd shift p)
- Once uploaded, go to Netlify interface and create a new site from git, connect to git, select repo, settings: Build command = hugo, Publish directory = Public, show advanced > HUGO_VERSION {get from terminal with hugo version command}, Save.
- Edit domain settings, point to netlify DNS from Hover, verify.
- Do A RECORD for plain domain, use @ for host
- Do CNAME for www domain, put www in host, url in other field
- Open site’s config.yml and update baseURL to match domain.
- Commit: git commit -m “{your message}”
- Push live: git push
showing ownership of repo in git with SSH keys (first site only)
- Generate key in terminal: ~ ssh-keygen -t rsa -b 4096 -C “email@example.com” {keyname}
- After pressing enter, give it a password
- Search for the key you just generated in terminal and ensure it was successful: ~ls | grep {keyname}
- View key: ~ cat {keyname: e.g. testkey.pub}
- Copy key: ~ pbcopy < ~ {keyname: e.g. testkey.pub}
- Make local machine aware of new key: Start ssh-agent in background: $ eval “$(ssh-agent -s)”
- Modify .ssh/config file:
- Check it’s in default location: $ open ~/.ssh/config - If not, create the file: $ touch ~/.ssh/config
- Open the file: vim ~.ssh/config
- Modify the config file to include the following: Host *.github.com AddKeysToAgent yes UseKeychain yes IdentityFile ~/.ssh/{id}
- Add your SSH private key to the ssh-agent and store your passphrase in the keychain: $ ssh-add –apple-use-keychain ~/.ssh/{id}
- Add the SSH key to your account on github: In github > settings > ssh and gpg keys > new ssh key > create a title and select type of key, paste key into “Key” field, click Add SSH Key.