Skip to content

Commit 6b1879f

Browse files
authored
Merge pull request #20 from zihanKuang/update-readme
Update CONTRIBUTING.md
2 parents 9bfc3d5 + 2733a91 commit 6b1879f

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

CONTRIBUTING.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,52 @@ information on using pull requests.
2626

2727
This project follows
2828
[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/).
29+
30+
## Local Development
31+
32+
To develop this theme locally, you can link it to a Hugo site (like the [academy starter template](https://github.com/layer5io/academy-example)) using a `replace` directive in the site's `go.mod` file.
33+
34+
1. **Directory Setup**
35+
36+
Ensure you have cloned both this theme repository and your Hugo site repository into the same parent directory. Your folder structure should look like this:
37+
```
38+
my-academy-content/
39+
├── academy-example/ <-- Your content project
40+
└── academy-theme/ <-- This theme project
41+
```
42+
43+
2. **Modify `go.mod`**
44+
45+
In your site's (`academy-example/`) `go.mod` file, add the following `replace` directive to point to your local theme folder:
46+
```go
47+
replace github.com/layer5io/academy-theme => ../academy-theme
48+
```
49+
50+
3. **Run the Server**
51+
Now, when you run `make site` from within your site's directory, Hugo will use your local theme files instead of fetching the remote module, allowing you to see your changes live.
52+
53+
## Updating the Theme
54+
55+
To ensure you have the latest version of the theme or to upgrade to a newer release, follow these steps:
56+
57+
1. **Update Go Module**
58+
Navigate to your Hugo site's root directory (e.g., `academy-example/`) in your terminal. Run the following command to update the theme module:
59+
```bash
60+
go get -u github.com/layer5io/academy-theme
61+
```
62+
This command will fetch the latest version of the theme and update your `go.mod` and `go.sum` files accordingly.
63+
64+
2. **Clean Cache (Optional but Recommended)**
65+
Sometimes, Hugo's cache might prevent the latest changes from being fully reflected. To clear the cache and ensure a fresh build:
66+
```bash
67+
hugo mod clean
68+
```
69+
70+
3. **Rebuild Your Site**
71+
After updating the theme, rebuild your Hugo site to incorporate the changes:
72+
73+
```bash
74+
make site
75+
```
76+
77+
Your site should now be running with the updated theme.

0 commit comments

Comments
 (0)