Manage Publishers with Bissetii in Hugo
After configuring and writing your pages, it's time to manage to publishers. Hugo supports a wide varieties of publishers available on the Internet. Hence, Bissetii must be able to provide support most of them.
Run Hugo Server
Before performing publication, you need to know how to execute the Hugo server for your development hosting. That way, it allows everyone including Bissetii developers to synchonize your development and communications. The recommended Hugo server command would be:
|
|
The hugo server instruction is to:
- Render the draft regardless of the page status.
- Disable fast rendering to avoid unnecessary caching.
- Bind
localhost
domain for local access - A working port number.
To ensure Bissetii works properly with restrictive output format (e.g. Accelerated Mobile Pages), Bissetii disabled Hugo’s auto-reload feature by default. Hence, you need to manually refresh the page to reflect your changes.
Also, be reminded that the hugo server
will hold the terminal until it is
completed. Hence, open a new terminal to execute it.
Build Your Website
Upon completing your development, you can proceed to build your site artifact for publications. The build command Bissetii team uses would be:
|
|
Bissetii configured the default output path is the public/
directory located
at your root directory (or 1 level above).
Commit to Publisher
With the compiled public/
artifact ready to be published, the next thing is
to commit it. Depending on the server providers, each provider has its own set
of implementations.
GitHub Pages
The most common static site generator hosting provider would be GitHub Pages. This section is for you if you’re using Github Pages as your primary hosting provider.
Manually Shift 404.html
Hugo compiled 404.html into the each language specific directory. Github Pages
specifically mentions that they can only accept 1 404.html
file at the root
directory. Hence, you need to copy it out.
Example, say you have en
language directory, your command would be something
as such:
|
|
DO NOT git commit your compiled public/
directory into your current
branch.
Create gh-pages
Branch
Bissetii strongly recommends to publish the artifact using the gh-pages
branch
method. This is because:
- It can avoid duplicated artifact copies.
- It avoids conflicting with your existing
docs/
directory. - It is easier, clearer, and simple to implement.
To start, simply create an empty gh-pages
branch. If you already done it and
have a gh-pages
branch already, simply skip this step. Otherwise, the
commands are as follows:
|
|
Clean Up Old Artifact
For those who do not want to keep multiple artifact copy (no point keeping them
since you can rebuild at any point of given time and commit ID), proceed to
clean up the gh-pages
branch to the first blank commit. The commands are:
|
|
Publish Your Artifact
Once you have the the gh-pages
branch ready, proceed to publish your public/
directory. The command is:
|
|
GitLab Pages
GitLab Pages shares the same
instructions as GitHub Pages. The only 1 extra one-time setup is to add the
additional GitLab CI instructions into your
gitlab-ci.yml
file. They are:
|
|
Basically, this is to instruct GitLab CI to package and publish the gh-pages
branch artifacts into its GitLab Pages component. Otherwise, it would not work
on GitLab since it is entirely depends on its GitLab CI to perform its
repository processing.
Wrapping Up
That is all for managing publishers with Bissetii in Hugo. If you have any question to ask us directly, please feel free to raise it at our GitLab Issues Section. We will be happy to assist you.