This website is primarily generated through hugo. I recently switched my main computer from a Surface Pro (v4) to a Dell Latitude 7320, which means that I had to reconfigure my website authoring environment from scratch. Along the way, there were lots of little hiccups because of a) changes to hugo since the last install and b) steps and tweaks that I’d not documented anywhere. It took a couple of hours, but everything is configured and publishing the way that I like again.
Generally speaking, I:
- took a backup of my existing site
- installed hugo-extended and git
- created my hugo site
- used git to link my site with github pages
- restored files
- published
I started by creating a .zip backup of my existing files. Then, I deleted all the existing files as they are in OneDrive. I don’t want the cloud copies being automatically pushed back down to my laptop while I’m configuring everything.
Next, I installed hugo-extended and git with chocolately package manager and powershell:
chocolatey install hugo-extended git -y
After that, I created my directories again, and told hugo that this was a new site:
C:\Users\Greg\OneDrive\myblog.dev.repo>hugo new site .
Congratulations! Your new Hugo site was created in C:\Users\Greg\OneDrive\myblog.dev.repo.
Just a few more steps...
1. Change the current directory to C:\Users\Greg\OneDrive\myblog.dev.repo.
2. Create or install a theme:
- Create a new theme with the command "hugo new theme <THEMENAME>"
- Or, install a theme from https://themes.gohugo.io/
3. Edit hugo.toml, setting the "theme" property to the theme name.
4. Create new content with the command "hugo new content <SECTIONNAME>\<FILENAME>.<FORMAT>".
5. Start the embedded web server with the command "hugo server --buildDrafts".
See documentation at https://gohugo.io/.
C:\Users\Greg\OneDrive\myblog.dev.repo>dir
Volume in drive C has no label.
Volume Serial Number is D8FC-8442
Directory of C:\Users\Greg\OneDrive\myblog.dev.repo
2024-07-10 11:53 AM <DIR> .
2024-07-10 11:53 AM <DIR> ..
2024-07-10 11:53 AM <DIR> archetypes
2024-07-10 11:53 AM <DIR> assets
2024-07-10 11:53 AM <DIR> content
2024-07-10 11:53 AM <DIR> data
2024-07-10 11:53 AM 83 hugo.toml
2024-07-10 11:53 AM <DIR> i18n
2024-07-10 11:53 AM <DIR> layouts
2024-07-10 11:53 AM <DIR> static
2024-07-10 11:53 AM <DIR> themes
1 File(s) 83 bytes
10 Dir(s) 434,143,707,136 bytes free
C:\Users\Greg\OneDrive\myblog.dev.repo>hugo server
Watching for changes in C:\Users\Greg\OneDrive\myblog.dev.repo\{archetypes,assets,content,data,i18n,layouts,static}
Watching for config changes in C:\Users\Greg\OneDrive\myblog.dev.repo\hugo.toml
Start building sites …
hugo v0.128.2-de36c1a95d28595d8243fd8b891665b069ed0850+extended windows/amd64 BuildDate=2024-07-04T08:13:25Z VendorInfo=gohugoio
WARN found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
| EN
-------------------+-----
Pages | 4
Paginator pages | 0
Non-page files | 0
Static files | 0
Processed images | 0
Aliases | 0
Cleaned | 0
Built in 7 ms
Environment: "development"
Serving pages from disk
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
C:\Users\Greg\OneDrive\myblog.dev.repo>dir
Volume in drive C has no label.
Volume Serial Number is D8FC-8442
Directory of C:\Users\Greg\OneDrive\myblog.dev.repo
2024-07-10 12:15 PM <DIR> .
2024-07-10 12:15 PM <DIR> ..
2024-07-10 12:15 PM 0 .hugo_build.lock
2024-07-10 11:53 AM <DIR> archetypes
2024-07-10 11:53 AM <DIR> assets
2024-07-10 11:53 AM <DIR> content
2024-07-10 11:53 AM <DIR> data
2024-07-10 11:53 AM 83 hugo.toml
2024-07-10 11:53 AM <DIR> i18n
2024-07-10 11:53 AM <DIR> layouts
2024-07-10 12:15 PM <DIR> public
2024-07-10 11:53 AM <DIR> static
2024-07-10 11:53 AM <DIR> themes
2 File(s) 83 bytes
11 Dir(s) 434,142,384,128 bytes free
I launched & killed hugo (above) just so that it can create all the files and directories that aren’t automatically generated (like /public). I then grabbed a copy of the stack theme and installed it in the themes directory:
C:\Users\Greg\OneDrive\myblog.dev.repo>git init
Initialized empty Git repository in C:/Users/Greg/OneDrive/myblog.dev.repo/.git/
C:\Users\Greg\OneDrive\myblog.dev.repo>git submodule add git@github.com:gbeifuss/hugo-theme-stack themes/hugo-theme-stack
Cloning into 'C:/Users/Greg/OneDrive/myblog.dev.repo/themes/hugo-theme-stack'...
remote: Enumerating objects: 3111, done.
remote: Total 3111 (delta 0), reused 0 (delta 0), pack-reused 3111
Receiving objects: 100% (3111/3111), 852.37 KiB | 2.10 MiB/s, done.
Resolving deltas: 100% (1964/1964), done.
warning: in the working copy of '.gitmodules', LF will be replaced by CRLF the next time Git touches it
After this, I restored all all of the necessary configuration files & assets from the backup into their appropriate locations. hugo.toml, archtypes/default.md, /static, /layout, /contents, etc.
The next step is to link this back up with my github page. I did grab a copy of my id_ed25519.pub file (has my SSH key for github authentication) from my old laptop and validated a successful connection:
C:\Users\Greg\OneDrive\myblog.dev.repo\public>ssh -T git@github.com
Hi gbeifuss! You've successfully authenticated, but GitHub does not provide shell access.
C:\Users\Greg\OneDrive\myblog.dev.repo\public>git remote add origin https://github.com/gbeifuss/gbeifuss.github.io.git
C:\Users\Greg\OneDrive\myblog.dev.repo\public>git remote -v
origin https://github.com/gbeifuss/gbeifuss.github.io.git (fetch)
origin https://github.com/gbeifuss/gbeifuss.github.io.git (push)
C:\Users\Greg\OneDrive\myblog.dev.repo\public>git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'https://github.com/gbeifuss/gbeifuss.github.io.git'
C:\Users\Greg\OneDrive\myblog.dev.repo\public>git checkout -b main
Switched to a new branch 'main'
C:\Users\Greg\OneDrive\myblog.dev.repo\public>git push --force origin main
Enumerating objects: 372, done.
Counting objects: 100% (372/372), done.
Delta compression using up to 8 threads
Compressing objects: 100% (230/230), done.
Writing objects: 100% (372/372), 1.74 MiB | 1.72 MiB/s, done.
Total 372 (delta 152), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (152/152), done.
To https://github.com/gbeifuss/gbeifuss.github.io.git
+ e4d1dbd...cccf12b main -> main (forced update)
C:\Users\Greg\OneDrive\myblog.dev.repo\public>git push origin main
Everything up-to-date
C:\Users\Greg\OneDrive\myblog.dev.repo\public>
Finally, create new content:
C:\Users\Greg\OneDrive\myblog.dev.repo>hugo new content/post/esxi_vmware_converter_error.md
Content "C:\\Users\\Greg\\OneDrive\\myblog.dev.repo\\content\\post\\esxi_vmware_converter_error.md" created
Use hugo server -D
to run the server in Draft mode, showing all published and draft content.
Use hugo
to create the entire static copy of the site for publishing.