Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ make site

#### Building the Site

To build the Academy site for production, ensure you have `Hugo` and `Go` installed. Now, run the following command to build the site:
To build the Academy site for production, ensure you have `npm` and `Go` installed. The local `hugo` binary is managed by `npm`. Ensure you have run `make setup` first, then run the following command to build the site:

```sh
make build
Expand Down
36 changes: 23 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,33 @@ include .github/build/Makefile.show-help.mk
setup:
npm install

## Verify required commands and local dependencies are present.
check-deps:
@echo "Checking if 'npm' and local 'hugo' binary are present..."
@command -v npm > /dev/null || { echo "Error: 'npm' not found. Please install Node.js and npm."; exit 1; }
@test -x node_modules/.bin/hugo || { echo "Error: Hugo binary not found in node_modules. Please run 'make setup' first."; exit 1; }
@echo "Dependencies check passed."

## Run on your local machine with draft and future content enabled.
site: check-go
hugo server -D -F
site: check-deps check-go
npm run dev:site

## Run on your local machine without file watching.
serve: check-deps check-go
npm run dev:serve

## Build site
build:
hugo
build: check-deps check-go
npm run dev:build

## Build site for local consumption
build-preview:
hugo --baseURL=$(BASEURL)
build-preview: check-deps check-go
npm run dev:build -- --baseURL="$(BASEURL)"

## Empty build cache and run on your local machine.
clean:
hugo --cleanDestinationDir
make setup
make site
clean:
npm run clean
$(MAKE) site

## Fix Markdown linting issues
lint-fix:
Expand All @@ -53,8 +63,8 @@ check-go:
@echo "Go is installed."

## Update the academy-theme package to latest version
theme-update:
theme-update: check-deps
echo "Updating to latest academy-theme..." && \
hugo mod get github.com/layer5io/academy-theme
npm run update:theme

.PHONY: setup build site clean check-go theme-update
.PHONY: setup check-deps build build-preview site serve clean check-go theme-update lint-fix
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Layer5 Academy

**Layer5 Academy** is the **official content repository** for Layer5's learning platform, hosting all official learning paths, challenges, and certifications.
It is built with [Hugo](https://gohugo.io/) and integrated into a multi-repository architecture for rapid local preview and automated cloud deployment.
It is built with [Hugo](https://gohugo.io/) (managed locally via npm) and integrated into a multi-repository architecture for rapid local preview and automated cloud deployment.

---

Expand Down Expand Up @@ -41,12 +41,13 @@ The Academy platform is composed of multiple repositories, each with a specific
## Quick Start (Local Preview)

> Use this workflow for a fast preview loop when editing Markdown content.
> **Note:** You do not need to install Hugo globally. The required `hugo-extended` binary is managed locally via npm when you run `make setup`.

```bash
# Clean up and verify Go module dependencies
go mod tidy

# Install necessary tools and modules
# Install necessary tools and modules (including local Hugo)
make setup

# Start the local Hugo development server
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@
"_build": "npm run _hugo-dev --",
"_check:links": "echo IMPLEMENTATION PENDING for check-links; echo",
"_hugo": "hugo --cleanDestinationDir",
"_hugo-dev": "npm run _hugo -- -e dev -DFE",
"_local": "npx cross-env HUGO_MODULE_WORKSPACE=docsy.work",
"_serve": "npm run _hugo-dev -- --minify serve --renderToMemory",
"_hugo-dev": "hugo --cleanDestinationDir -e dev -DFE",
"_local": "cross-env HUGO_MODULE_WORKSPACE=docsy.work",
"_serve": "npm run _hugo-dev -- server --minify --renderToMemory",
"build:preview": "npm run _hugo-dev -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"",
"build:production": "npm run _hugo -- --minify",
"build": "npm run _build -- ",
"check:links:all": "HTMLTEST_ARGS= npm run _check:links",
"check:links": "npm run _check:links",
"clean": "rm -Rf public/* resources",
"dev:build": "npm run _hugo-dev --",
"dev:serve": "npm run _hugo-dev -- server --watch=false",
"dev:site": "npm run _hugo-dev -- server",
"local": "npm run _local -- npm run",
"make:public": "git init -b main public",
"precheck:links:all": "npm run build",
Expand All @@ -32,7 +35,8 @@
"test": "npm run check:links",
"update:dep": "npm install --save-dev autoprefixer@latest postcss-cli@latest",
"update:hugo": "npm install --save-dev --save-exact hugo-extended@latest",
"update:pkgs": "npx npm-check-updates -u"
"update:pkgs": "npx npm-check-updates -u",
"update:theme": "hugo mod get github.com/layer5io/academy-theme"
},
"devDependencies": {
"autoprefixer": "^10.4.21",
Expand Down
Loading