I am embarking on this new journey to use Static Site Generator.
So far, I have managed to setup:
I have a shared hosting service (for many years now) so I want to use that to host my site. This added some (small) challenges in my journey. I will share my experience, so far and in future, in this post. One thing that I really like is how natural I find this. After all I am a Programmer.
You can fork my repository (link above) and follow the simple instruction on the
README.md to start using. I will use my own repository for instructions here.
Before you start, get these softwares and setup correctly
I use autoenv to manager per-project shell environment. It executes
.env file in the directory when you
cd into it. This is optional but very useful.
Here are some changes that you should consider:
- You should probably delete
- You should change information in
config.toml, consider changing:
- [menu.icon] links
You can run development server using following command
What the hell! Read instruction in
hugo server --help to understand what each of those switches mean. We are asking hugo to:
- -w : watch for changes
- -D : build draft
- -E : build expired pages
- -F : build future date page,
- -b : set base url to
- –navigateToChanged : navigate browser to updated file
- –cleanDestinationDir: Delete all the files that might be there in destination dir
- -d : Destination dir to store files into
You can add your own content using command like
When you want to prepare actual deployment, you can use following command
First, login to firebase from cli. This needs to be done only once. If you have already done this for any other prohect, you can skip this step
Now you need to initialize firebase setting for the project. This will run as a wizard. Follow onscreen instructions.
You may test your firebase configuration by deploying changes directly from your machine
Important: Choose “N” for “Configure as a single-page app (rewrite all urls to /index.html)?”. Also, don’t overwrite files under
Based on Travis CI - Firebase Deployment
Create a new project on Travis CI website website. Login to Travis CI via
Get a deployment token from firebase, for using in travis ci build environment.
This should generate a string that looks like
Use following command to encrypt this string and use in
deploy key in
.travis.yml with folowing text. Remember to change
SUPER-SECRET-ENCRYPTED-VALUE with text from last command output
That’s it! Don’t forget to checkin your changes.