Prepare Source Code

Before proceeding with the steps below, make sure that you have Git Bash installed on your computer.
If not, you can download it here: Download Git Bash

Execution sequence

  1. Create a new directory on your computer. I’m naming it as WORKSHOP. CODE

  2. Copy your Hugo Source Code folder into the WORKSHOP directory.
    Here we are using a Sample Source Code. You can Download the Sample Source Code, then unzip it into the WORKSHOP directory with the name 000058-SessionManager CODE

  3. Navigate into the 000058-SessionManager directory

  • Right-click in an empty area of the folder, then choose Git Bash Here CODE

  • The Git Bash interface will appear. Press the Windows key along with the right arrow 🡒 or left arrow ⭠ to split the screen into two windows.
    On the right is the Git Bash window, and on the left is the 000058-SessionManager directory for easier operations in the following steps. (This is optional) CODE

  1. In the Git Bash interface, execute the following commands:
  • Display the first 10 lines of the config.toml file:
head -10 config.toml
  • Add the relativeURLs=true attribute to the first line of the config.toml file
sed -i '1 i\relativeURLs = true' config.toml
  • Displays the first 10 lines of the config.toml file after changing, has added the relativeURLs = true attribute in the first line
head -10 config.toml
  • Rebuild Hugo Source Code after making changes in the config.toml file
hugo

CODE

Adding the relativeURLs = true attribute to the first line of the config.toml file is the key step of this Lab.
It will update all resource paths like css, images, … to relative paths, ensuring correct resource retrieval later.