You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: exampleSite/content/posts/start/setup/quick-start.md
+58-8Lines changed: 58 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,26 +63,76 @@ Use the npm scripts instead of calling `hugo` directly. They add `node_modules/.
63
63
64
64
## Use Nerdy in your site
65
65
66
-
Add the theme as a Hugo module import:
66
+
Run these steps from your Hugo site's root directory, not from the Nerdy theme checkout.
67
67
68
-
```yaml
69
-
module:
70
-
imports:
71
-
- path: github.com/hugo-themes/nerdy
68
+
If your site is not already a Hugo module, initialize one first:
69
+
70
+
```sh
71
+
hugo mod init github.com/you/your-site
72
72
```
73
73
74
-
Enable Hugo build stats so Tailwind can discover classes emitted by templates:
74
+
Add the theme import and Tailwind build-stat wiring to `hugo.yaml`:
75
75
76
76
```yaml
77
77
build:
78
78
buildStats:
79
79
enable: true
80
+
cachebusters:
81
+
- source: 'assets/notwatching/hugo_stats\.json'
82
+
target: css
83
+
84
+
module:
85
+
imports:
86
+
- path: github.com/hugo-themes/nerdy
87
+
mounts:
88
+
- source: assets
89
+
target: assets
90
+
- disableWatch: true
91
+
source: hugo_stats.json
92
+
target: assets/notwatching/hugo_stats.json
93
+
```
94
+
95
+
If your site already has `module.imports` or `module.mounts`, merge these entries instead of replacing your existing configuration. The `hugo_stats.json` mount gives Tailwind a stable file to scan without making Hugo watch its own generated build-stat file.
96
+
97
+
Create or update `package.json` with scripts for local development, production builds, and theme dependency refreshes:
98
+
99
+
```json
100
+
{
101
+
"name": "your-site",
102
+
"version": "0.1.0",
103
+
"private": true,
104
+
"type": "module",
105
+
"scripts": {
106
+
"build": "hugo --renderToMemory && hugo --minify --gc --cleanDestinationDir",
107
+
"server": "hugo --renderToMemory && hugo server --buildDrafts --watch",
108
+
"dev": "npm run server",
109
+
"theme:update": "hugo mod get github.com/hugo-themes/nerdy@latest && hugo mod tidy && hugo mod npm pack && npm install",
110
+
"theme:update-to-main": "hugo mod get github.com/hugo-themes/nerdy@main && hugo mod tidy && hugo mod npm pack && npm install"
111
+
}
112
+
}
80
113
```
81
114
82
-
Then copy only the data files and content structure you want from `exampleSite/`.
115
+
Install the theme module and npm dependencies:
116
+
117
+
```sh
118
+
hugo mod get github.com/hugo-themes/nerdy@latest
119
+
hugo mod tidy
120
+
hugo mod npm pack
121
+
npm install
122
+
```
123
+
124
+
`hugo mod npm pack`reads Nerdy's `package.hugo.json`, creates `packages/hugoautogen/package.json`, and adds that generated package as an npm workspace. This keeps Tailwind, Alpine.js, and other theme asset dependencies in sync without copying them by hand.
125
+
126
+
Then copy only the data files, assets, and content structure you want from `exampleSite/`, such as `data/sidebar.yaml`, `data/home/`, `data/terminal/`, and `content/posts/`.
83
127
84
128
If you copy from `exampleSite/hugo.yaml`, do not copy the `module.replacements` line. That line is only for this repository so the demo site can point at the local theme checkout.
85
129
86
-
Your site also needs the npm dependencies used by Nerdy's asset pipeline. Use this repository's `package.json` as the reference set for Tailwind and Alpine.js. Add Portless too only if you want the same stable local HTTPS workflow.
130
+
Start your site with:
131
+
132
+
```sh
133
+
npm run server
134
+
```
135
+
136
+
Run `npm run theme:update` whenever you want to pull the latest Nerdy release and refresh the generated npm workspace. If you want the newest commit from the `main` branch instead, run `npm run theme:update-to-main`.
87
137
88
138
Next, read the content organization and customization guides for the parts of the site you want to change.
0 commit comments