Quick Start

Using Hugo with S4.

To deploy your Hugo site in a S4 environment, you will need to request us to add that functionality to your site repo.

Once you have that added to your site repo, you will need to make sure your local hugo site folder is accessible with git.

Linux

If you have little or no files in your site repo, go into your hugo site directory (example mysite). If you have a full set of site files in the repo, I suggest you pull them down, make a backup of them first. Then, once you have made your backup, do a git remove of the files and folders in the repo. (see below)

Initially, there will be at least four files in your site repo that we give you: README.md instructions.md, error.html, .gitlab-ci.yml. Do not remove them. The *.md files, typically are not viewed via a browser, as most do not know they are there.

The hugo command builds the site files to be viewed by the browser. The default folder name is “public”, and is what we use. Make sure your config file has publishdir set to “public”.

Run the hugo command to get the public folder created (example hugo site folder mysite).

cd mysite
hugo

Run the git command to initialize git to the folder.

git init

Run the git command to add the site repo to your local hugo site folder (example mysite).

https version

git remote add origin https://code.vt.edu/s4-hosting-sites/mysite.git

ssh version

git remote add origin git@code.vt.edu:s4-hosting-sites/mysite.git

If you already have a remote repo set, you can change the url.

https version

git remote set-url origin https://code.vt.edu/s4-hosting-sites/mysite.git

ssh version

git remote set-url origin git@code.vt.edu:s4-hosting-sites/mysite.git

Pull all files from the repo into your folder.

git pull origin master

Add all of your files to git, to push.

git add *

or

git add .

Add a comment about the files being added or changes being made.

git commit -m 'Adding the initial files to the repo.'

Push the files to the remote repo.

git push origin master