|
1 | | -# Docsy Example |
| 1 | +# SwanLake Website |
2 | 2 |
|
3 | | -[Docsy][] is a [Hugo theme module][] for technical documentation sites, |
4 | | -providing easy site navigation, structure, and more. This **Docsy Example |
5 | | -Project** uses the Docsy theme component as a hugo module and provides a |
6 | | -skeleton documentation structure for you to use. You can clone/copy this project |
7 | | -and edit it with your own content, or use it as an example. |
| 3 | +This repository contains the Hugo + Docsy website for the SwanLake project. |
8 | 4 |
|
9 | | -In this project, the Docsy theme is pulled in as a Hugo module, together with |
10 | | -its dependencies: |
| 5 | +- Main project: <https://github.com/swanlake-io/swanlake> |
| 6 | +- Website source: <https://github.com/swanlake-io/swanlake.github.io> |
11 | 7 |
|
12 | | -```console |
13 | | -$ hugo mod graph |
14 | | -... |
15 | | -``` |
16 | | - |
17 | | -For Docsy documentation, see [Docsy user guide][]. |
18 | | - |
19 | | -This Docsy Example Project is hosted on [Netlify][] at [example.docsy.dev][]. |
20 | | -You can view deploy logs from the [deploy section of the project's Netlify |
21 | | -dashboard][deploys], or this [alternate dashboard][]. |
22 | | - |
23 | | -This is not an officially supported Google product. This project is currently |
24 | | -maintained. |
25 | | - |
26 | | -## Using the Docsy Example Project as a template |
27 | | - |
28 | | -A simple way to get started is to use this project as a template, which gives |
29 | | -you a site project that is set up and ready to use. To do this: |
30 | | - |
31 | | -1. Use the dropdown for switching branches/tags to change to the **latest** |
32 | | - released tag. |
33 | | - |
34 | | -2. Click **Use this template**. |
35 | | - |
36 | | -3. Select a name for your new project and click **Create repository from |
37 | | - template**. |
38 | | - |
39 | | -4. Make your own local working copy of your new repo using git clone, replacing |
40 | | - https://github.com/me/example.git with your repo’s web URL: |
41 | | - |
42 | | -```bash |
43 | | -git clone --depth 1 https://github.com/me/example.git |
44 | | -``` |
45 | | - |
46 | | -Depending on your environment you may need to adjust the top-level `module` |
47 | | -settings in your project's Hugo config file, for example, by adding a proxy to |
48 | | -use when downloading remote modules. You can find details of what these |
49 | | -configuration settings do in the |
50 | | -[Hugo modules documentation](https://gohugo.io/hugo-modules/configuration/#module-config-top-level). |
51 | | - |
52 | | -Once your settings are adjusted, you can edit your own versions of the site’s |
53 | | -source files. |
| 8 | +## Local development |
54 | 9 |
|
55 | | -If you want to do SCSS edits and want to publish these, you need to install |
56 | | -`PostCSS` |
| 10 | +Prerequisites: |
| 11 | +- Hugo extended (`>= 0.155.0`) |
| 12 | +- Go (for Hugo module resolution) |
57 | 13 |
|
58 | | -```bash |
59 | | -npm install |
60 | | -``` |
61 | | - |
62 | | -## Running the website locally |
63 | | - |
64 | | -Building and running the site locally requires a recent `extended` version of |
65 | | -[Hugo](https://gohugo.io). You can find out more about how to install Hugo for |
66 | | -your environment in our |
67 | | -[Getting started](https://www.docsy.dev/docs/getting-started/#prerequisites-and-installation) |
68 | | -guide. |
69 | | - |
70 | | -Once you've made your working copy of the site repo, from the repo root folder, |
71 | | -run: |
| 14 | +Run locally: |
72 | 15 |
|
73 | 16 | ```bash |
74 | 17 | hugo server |
75 | 18 | ``` |
76 | 19 |
|
77 | | -## Running a container locally |
78 | | - |
79 | | -You can run docsy-example inside a [Docker](https://docs.docker.com/) container, |
80 | | -the container runs with a volume bound to the `docsy-example` folder. This |
81 | | -approach doesn't require you to install any dependencies other than |
82 | | -[Docker Desktop](https://www.docker.com/products/docker-desktop) on Windows and |
83 | | -Mac, and [Docker Compose](https://docs.docker.com/compose/install/) on Linux. |
84 | | - |
85 | | -1. Build the docker image |
86 | | - |
87 | | - ```bash |
88 | | - docker-compose build |
89 | | - ``` |
90 | | - |
91 | | -1. Run the built image |
92 | | - |
93 | | - ```bash |
94 | | - docker-compose up |
95 | | - ``` |
96 | | - |
97 | | - > NOTE: You can run both commands at once with `docker-compose up --build`. |
98 | | -
|
99 | | -1. Verify that the service is working. |
100 | | - |
101 | | - Open your web browser and type `http://localhost:1313` in your navigation |
102 | | - bar, This opens a local instance of the docsy-example homepage. You can now |
103 | | - make changes to the docsy example and those changes will immediately show up |
104 | | - in your browser after you save. |
105 | | - |
106 | | -### Cleanup |
107 | | - |
108 | | -To stop Docker Compose, on your terminal window, press **Ctrl + C**. |
109 | | - |
110 | | -To remove the produced images run: |
| 20 | +Build static output: |
111 | 21 |
|
112 | 22 | ```bash |
113 | | -docker-compose rm |
114 | | -``` |
115 | | - |
116 | | -For more information see the [Docker Compose documentation][]. |
117 | | - |
118 | | -## Using a local Docsy clone |
119 | | - |
120 | | -Make sure your installed go version is `1.18` or higher. |
121 | | - |
122 | | -Clone the latest version of the docsy theme into the parent folder of your |
123 | | -project. The newly created repo should now reside in a sibling folder of your |
124 | | -site's root folder. |
125 | | - |
126 | | -```shell |
127 | | -cd root-of-your-site |
128 | | -git clone --branch v0.12.0 https://github.com/google/docsy.git ../docsy |
129 | | -``` |
130 | | - |
131 | | -Now run: |
132 | | - |
133 | | -```shell |
134 | | -HUGO_MODULE_WORKSPACE=docsy.work hugo server --ignoreVendorPaths "**" |
135 | | -``` |
136 | | - |
137 | | -or, when using npm, prepend `local` to the script you want to invoke, e.g.: |
138 | | - |
139 | | -```shell |
140 | | -npm run local serve |
141 | | -``` |
142 | | - |
143 | | -By using the `HUGO_MODULE_WORKSPACE` directive (either directly or via prefix |
144 | | -`local` when using npm), the server now watches all files and directories inside |
145 | | -the sibling directory `../docsy` , too. Any changes inside the local `docsy` |
146 | | -theme clone are now immediately picked up (hot reload), you can instantly see |
147 | | -the effect of your local edits. |
148 | | - |
149 | | -In the command above, we used the environment variable `HUGO_MODULE_WORKSPACE` |
150 | | -to tell hugo about the local workspace file `docsy.work`. Alternatively, you can |
151 | | -declare the workspace file inside your settings file `hugo.toml`: |
152 | | - |
153 | | -```toml |
154 | | -[module] |
155 | | - workspace = "docsy.work" |
156 | | -``` |
157 | | - |
158 | | -Your project's `hugo.toml` file already contains these lines, the directive for |
159 | | -workspace assignment is commented out, however. Remove the two trailing comment |
160 | | -characters '//' so that this line takes effect. |
161 | | - |
162 | | -## Troubleshooting |
163 | | - |
164 | | -As you run the website locally, you may run into the following error: |
165 | | - |
166 | | -```console |
167 | | -$ hugo server |
168 | | -WARN 2023/06/27 16:59:06 Module "project" is not compatible with this Hugo version; run "hugo mod graph" for more information. |
169 | | -Start building sites … |
170 | | -hugo v0.101.0-466fa43c16709b4483689930a4f9ac8add5c9f66+extended windows/amd64 BuildDate=2022-06-16T07:09:16Z VendorInfo=gohugoio |
171 | | -Error: Error building site: "C:\Users\foo\path\to\docsy-example\content\en\_index.md:5:1": failed to extract shortcode: template for shortcode "blocks/cover" not found |
172 | | -Built in 27 ms |
| 23 | +hugo --gc --minify |
173 | 24 | ``` |
174 | 25 |
|
175 | | -This error occurs if you are running an outdated version of Hugo. As of docsy |
176 | | -theme version `v0.12.0`, hugo version `0.146.0` or higher is required. See this |
177 | | -[section](https://www.docsy.dev/docs/get-started/docsy-as-module/installation-prerequisites/#install-hugo) |
178 | | -of the user guide for instructions on how to install Hugo. |
179 | | - |
180 | | -Or you may be confronted with the following error: |
| 26 | +## Content structure |
181 | 27 |
|
182 | | -```console |
183 | | -$ hugo server |
184 | | - |
185 | | -INFO 2021/01/21 21:07:55 Using config file: |
186 | | -Building sites … INFO 2021/01/21 21:07:55 syncing static files to / |
187 | | -Built in 288 ms |
188 | | -Error: Error building site: TOCSS: failed to transform "scss/main.scss" (text/x-scss): resource "scss/scss/main.scss_9fadf33d895a46083cdd64396b57ef68" not found in file cache |
189 | | -``` |
190 | | - |
191 | | -This error occurs if you have not installed the extended version of Hugo. See |
192 | | -this |
193 | | -[section](https://www.docsy.dev/docs/get-started/docsy-as-module/installation-prerequisites/#install-hugo) |
194 | | -of the user guide for instructions on how to install Hugo. |
195 | | - |
196 | | -Or you may encounter the following error: |
197 | | - |
198 | | -```console |
199 | | -$ hugo server |
200 | | - |
201 | | -Error: failed to download modules: binary with name "go" not found |
202 | | -``` |
| 28 | +- Homepage: `content/en/_index.md` |
| 29 | +- Docs landing: `content/en/docs/_index.md` |
| 30 | +- Core docs pages: `content/en/docs/*.md` |
| 31 | +- About page: `content/en/about/index.md` |
| 32 | +- Community page: `content/en/community/_index.md` |
| 33 | +- Static images: `static/images/` |
203 | 34 |
|
204 | | -This error occurs if the `go` programming language is not available on your |
205 | | -system. See this |
206 | | -[section](https://www.docsy.dev/docs/get-started/docsy-as-module/installation-prerequisites/#install-go-language) |
207 | | -of the user guide for instructions on how to install `go`. |
| 35 | +## Deployment |
208 | 36 |
|
209 | | -[alternate dashboard]: https://app.netlify.com/sites/goldydocs/deploys |
210 | | -[deploys]: https://app.netlify.com/sites/docsy-example/deploys |
211 | | -[Docsy user guide]: https://docsy.dev/docs |
212 | | -[Docsy]: https://github.com/google/docsy |
213 | | -[example.docsy.dev]: https://example.docsy.dev |
214 | | -[Hugo theme module]: |
215 | | - https://gohugo.io/hugo-modules/use-modules/#use-a-module-for-a-theme |
216 | | -[Netlify]: https://netlify.com |
217 | | -[Docker Compose documentation]: https://docs.docker.com/compose/gettingstarted/ |
| 37 | +This site is intended for GitHub Pages deployment from this repository. |
218 | 38 |
|
219 | | -<!-- cSpell:ignore hugo docsy TOCSS --> |
| 39 | +If you decide between `swanlake.github.io` and `swanlake-io.github.io`, update `baseURL` in `hugo.yaml` to the final canonical URL. |
0 commit comments