Skip to content

Add a Makefile to install Hugo and start preview - #15

Merged
JeremyMcCormick merged 1 commit into
mainfrom
iss14
May 20, 2024
Merged

JeremyMcCormick merged 1 commit into
mainfrom
iss14

Conversation

@gmantele

Copy link
Copy Markdown
Member

Makefile to perform few Hugo actions. By default, the make command returns the following listing of available commands:

Available targets:

* help        Display this help (i.e. list all available targets). 
              (DEFAULT TARGET)

* preview     Start the preview service (on port 1313). All required 
              tools are installed/upgraded automatically, when needed.

* list-draft  List all draft pages (i.e. all pages only visible 
              in preview mode).

* install     Install Hugo (or upgrade it if a different version is 
              set in Makefile).

* uninstall   Uninstall Hugo.

Fixes #14

@gmantele gmantele self-assigned this May 20, 2024
@gmantele

Copy link
Copy Markdown
Member Author

This Makefile is an adapted version of the one I used for the website I am managing.
We can of course easily rename targets, or even add/remove some.

@gmantele

Copy link
Copy Markdown
Member Author

The target preview calls a bash script doing several things (which were quite complicated to do in a Makefile):

  1. Check whether the port 1313 is available or not. If not, an error message is displayed with the PID of the currently running Hugo preview.
  2. Start Hugo in preview + watch mode.
  3. Wait a bit for it to be operational.
  4. Open the preview website in a web browser.

@molinaro-m molinaro-m left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested locally on my laptop (an outdated fedora) and it works.
I'm not sure we will initially use the draft list feature, but it makes sense to have it there for later.

@gmantele

Copy link
Copy Markdown
Member Author

I tested locally on my laptop (an outdated fedora) and it works. I'm not sure we will initially use the draft list feature, but it makes sense to have it there for later.

Good to know that it works on an outdated Fedora. I had not yet user with this Linux distribution.

@JeremyMcCormick
JeremyMcCormick merged commit 3ffc019 into main May 20, 2024
@JeremyMcCormick
JeremyMcCormick deleted the iss14 branch April 30, 2025 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a Makefile to install Hugo and start the preview

3 participants