Skip to content

Commit 8200675

Browse files
chalinLisaFC
andauthored
Docsy 0.4.0 migration instructions and doc updates (#1074)
* Docsy 0.4.0 migration instructions and doc updates * Also drop --recurse-submodules * tiny fix Co-authored-by: LisaFC <[email protected]>
1 parent 5d03fd9 commit 8200675

File tree

5 files changed

+113
-71
lines changed

5 files changed

+113
-71
lines changed

CHANGELOG.md

+36-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,42 @@ For a list of issues targeted for the next release, see the [22Q2][] milestone.
66

77
## [0.4.0][] - next planned release (unpublished yet)
88

9-
TBC
9+
**Breaking changes**:
10+
11+
- Docsy no longer uses git submodules for Bootstrap and FontAwesome. If your
12+
project uses [Hugo Modules][], then this change doesn't impact you.
13+
14+
For projects with [other Docsy setups][], use the NPM packages of Bootstrap
15+
and FontAwesome. Migrate your site by following these steps (execute commands
16+
from your project's root directory):
17+
18+
1. Update Docsy to 0.4.0.
19+
2. Delete obsolete Docsy Git submodules:
20+
```console
21+
$ rm -Rf themes/docsy/assets/vendor
22+
```
23+
3. Get Docsy dependencies:
24+
```console
25+
$ (cd themes/docsy && npm install)
26+
```
27+
4. (Optional) If your site project uses NPM, consider getting Docsy
28+
dependencies via a `prepare` script, for example:
29+
```json
30+
{
31+
"name": "my-website",
32+
"scripts": {
33+
"get:submodule": "git submodule update --init --depth 1",
34+
"_prepare:docsy": "cd themes/docsy && npm install",
35+
"prepare": "npm run get:submodule && npm run _prepare:docsy",
36+
"...": "..."
37+
},
38+
"...": "..."
39+
}
40+
```
41+
5. Proceed as usual to build or serve your site.
42+
43+
[Hugo Modules]: https://www.docsy.dev/docs/get-started/docsy-as-module/
44+
[other Docsy setups]: https://www.docsy.dev/docs/get-started/other-options/
1045

1146
## [0.3.0][]
1247

userguide/content/en/docs/Contribution guidelines/_index.md

+13-15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
---
2-
title: "Contribution Guidelines"
3-
linkTitle: "Contribution Guidelines"
2+
title: Contribution Guidelines
43
weight: 9
5-
description: >
6-
How to contribute to Docsy
4+
description: How to contribute to Docsy
75
---
86

97
Docsy is an open source project and we love getting patches and contributions to make Docsy and its docs even better.
@@ -54,15 +52,15 @@ We use [Netlify](https://www.netlify.com/) to manage the deployment of the site
5452

5553
1. Fork the [Docsy repo](https://github.com/google/docsy) on GitHub: this site's files live in the `userguide` subdirectory.
5654
1. Make your changes and send a pull request (PR).
57-
1. If you're not yet ready for a review, add "WIP" to the PR name to indicate
58-
it's a work in progress. (**Don't** add the Hugo property
59-
"draft = true" to the page front matter, because that prevents the
55+
1. If you're not yet ready for a review, add "WIP" to the PR name to indicate
56+
it's a work in progress. (**Don't** add the Hugo property
57+
"draft = true" to the page front matter, because that prevents the
6058
auto-deployment of the content preview described in the next point.)
6159
1. Wait for the automated PR workflow to do some checks. When it's ready,
6260
you should see a comment like this: **deploy/netlify — Deploy preview ready!**
6361
1. Click **Details** to the right of "Deploy preview ready" to see a preview
6462
of your updates.
65-
1. Continue updating your doc and pushing your changes until you're happy with
63+
1. Continue updating your doc and pushing your changes until you're happy with
6664
the content.
6765
1. When you're ready for a review, add a comment to the PR, and remove any
6866
"WIP" markers.
@@ -81,22 +79,22 @@ If you've just spotted something you'd like to change while using the docs, Docs
8179
If you want to run your own local Hugo server to preview your changes as you work:
8280

8381
1. Follow the instructions in [Getting started](/docs/getting-started) to install Hugo and any other tools you need.
84-
1. Fork the [Docsy](https://github.com/google/docsy) repo into your own project, then create a local copy using `git clone`. Don’t forget to use `--recurse-submodules` or you won’t pull down some of the code you need to generate a working site.
82+
1. Fork the [Docsy](https://github.com/google/docsy) repo into your own project, then create a local copy using `git clone`:
8583

86-
```
87-
git clone --recurse-submodules --depth 1 https://github.com/google/docsy.git
84+
```sh
85+
git clone https://github.com/google/docsy.git
8886
```
8987

9088
1. Change to the `userguide` directory and run the following Hugo command to build the site and start the Hugo server.
9189
Note that you need the `themesDir` flag because the site files are inside the theme repo.
9290

93-
```
91+
```sh
9492
cd userguide
9593
hugo server --themesDir ../..
9694
```
97-
95+
9896
By default your site will be available at http://localhost:1313/. Now that you're serving your site locally, Hugo will watch for changes to the content and automatically refresh your site.
99-
97+
10098
1. Continue with the usual GitHub workflow to edit files, commit them, push the
10199
changes up to your fork, and create a pull request.
102100
@@ -111,7 +109,7 @@ locally with Docker, without installing any additional dependencies.
111109
112110
```bash
113111
docker build -t docsy/user-guide .
114-
```
112+
```
115113
116114
1. Run the container, mounting the repository as a shared volume:
117115

userguide/content/en/docs/Deployment/_index.md

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
---
2-
title: "Previews and Deployment"
3-
linkTitle: "Previews and Deployment"
2+
title: Previews and Deployment
43
weight: 7
5-
description: >
6-
Deploying your Docsy site.
4+
description: Deploying your Docsy site.
75
---
86

97
There are multiple possible options for deploying a Hugo site, including Netlify, Firebase Hosting, Bitbucket with Aerobatic, and more; you can read about them all in [Hosting and Deployment](https://gohugo.io/hosting-and-deployment/). Hugo also makes it easy to deploy your site locally for quick previews of your content.
@@ -12,20 +10,10 @@ There are multiple possible options for deploying a Hugo site, including Netlify
1210

1311
Depending on your deployment choice you may want to serve your site locally during development to preview content changes. To serve your site locally:
1412

15-
1. Ensure you have an up to date local copy of your site files cloned from your repo. Don't forget to use `--recurse-submodules` or you won't pull down some of the code you need to generate a working site.
16-
17-
```
18-
git clone --recurse-submodules --depth 1 https://github.com/my/example.git
19-
```
20-
21-
{{% alert title="Note" color="primary" %}}
22-
If you've just added the theme as a submodule in a local version of your site and haven't committed it to a repo yet, you must get local copies of the theme's own submodules before serving your site.
23-
24-
git submodule update --init --recursive
25-
{{% /alert %}}
13+
1. Ensure you have an up to date local copy of your site files cloned from your repo.
2614

2715
1. Ensure you have the tools described in [Prerequisites and installation](/docs/get-started/docsy-as-module/installation-prerequisites) installed on your local machine, including `postcss-cli` (you'll need it to generate the site resources the first time you run the server).
28-
1. Run the `hugo server` command in your site root. By default your site will be available at http://localhost:1313/.
16+
1. Run the `hugo server` command in your site root. By default your site will be available at <http://localhost:1313>.
2917

3018
Now that you're serving your site locally, Hugo will watch for changes to the content and automatically refresh your site. If you have more than one local git branch, when you switch between git branches the local website reflects the files in the current branch.
3119

userguide/content/en/docs/Get started/_index.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11

22
---
3-
title: "Get started"
4-
linkTitle: "Get started"
3+
title: Get started
54
weight: 2
6-
aliases:
7-
- /docs/getting-started/
5+
aliases: [/docs/getting-started/]
86
date: 2018-07-30
9-
description: >
10-
Learn how to get started with Docsy, including the available options for installing and using the Docsy theme.
7+
description:
8+
Learn how to get started with Docsy, including the available options for
9+
installing and using the Docsy theme.
1110
---
1211

1312
As you saw in our introduction, Docsy is a [Hugo](https://gohugo.io) theme, which means that if you want to use Docsy, you need to set up your website source so that the Hugo static site generator can find and use the Docsy theme files when building your site. The simplest way to do this is to copy and edit our example site, though we also provide instructions for adding the Docsy theme manually to new or existing sites.

userguide/content/en/docs/Get started/other-options.md

+55-33
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
2-
title: "Other setup options"
3-
linkTitle: "Other setup options"
2+
title: Other setup options
43
date: 2021-12-08T09:22:27+01:00
54
weight: 2
6-
description: >
5+
description:
76
Create a new Docsy site with Docsy as a Git submodule or cloned theme
87
---
98

@@ -15,9 +14,9 @@ This guide provides instructions for both these options, along with common prere
1514

1615
## Prerequisites and installation
1716

18-
### Install Hugo
17+
### Install Hugo
1918

20-
You need a [recent **extended** version](https://github.com/gohugoio/hugo/releases) (we recommend version 0.73.0 or later) of [Hugo](https://gohugo.io/) to do local builds and previews of sites (like this one) that use Docsy. If you install from the release page, make sure to get the `extended` Hugo version, which supports [SCSS](https://sass-lang.com/documentation/file.SCSS_FOR_SASS_USERS.html); you may need to scroll down the list of releases to see it.
19+
You need a [recent **extended** version](https://github.com/gohugoio/hugo/releases) (we recommend version 0.73.0 or later) of [Hugo](https://gohugo.io/) to do local builds and previews of sites (like this one) that use Docsy. If you install from the release page, make sure to get the `extended` Hugo version, which supports [SCSS](https://sass-lang.com/documentation/file.SCSS_FOR_SASS_USERS.html); you may need to scroll down the list of releases to see it.
2120

2221
For comprehensive Hugo documentation, see [gohugo.io](https://gohugo.io/).
2322

@@ -30,8 +29,9 @@ If you've already installed Hugo, check your version:
3029
```
3130
hugo version
3231
```
32+
3333
If the result is `v0.73` or earlier, or if you don't see `Extended`, you'll need to install the latest version. You can see a complete list of Linux installation options in [Install Hugo](https://gohugo.io/getting-started/installing/#linux). The following shows you how to install Hugo from the release page:
34-
34+
3535
1. Go to the [Hugo releases](https://github.com/gohugoio/hugo/releases) page.
3636
2. In the most recent release, scroll down until you find a list of
3737
**Extended** versions.
@@ -48,7 +48,7 @@ If the result is `v0.73` or earlier, or if you don't see `Extended`, you'll need
4848

4949
7. Install Hugo:
5050

51-
sudo install hugo /usr/bin
51+
sudo install hugo /usr/bin
5252

5353
#### On macOS
5454

@@ -81,42 +81,64 @@ npm install -D postcss
8181

8282
Note that versions of `PostCSS` later than 5.0.1 will not load `autoprefixer` if installed [globally](https://flaviocopes.com/npm-packages-local-global/), you must use a local install.
8383

84-
## Other option 1: Use the theme as a submodule
84+
## Option 1: Docsy as a Git submodule
8585

86-
To create a new Hugo site project and then add the Docsy theme as a submodule, run the following commands from your project's root directory.
86+
To create a **new site** and add the Docsy theme as a Git submodule, run the
87+
following commands:
8788

88-
```shell
89-
hugo new site myproject
90-
cd myproject
91-
git init
92-
git submodule add https://github.com/google/docsy.git themes/docsy
93-
echo 'theme = "docsy"' >> config.toml
94-
git submodule update --init --recursive
95-
```
89+
1. Create the site:
9690

97-
To add the Docsy theme to an existing site, run the following commands from your project's root directory:
91+
```shell
92+
hugo new site myproject
93+
cd myproject
94+
git init
95+
```
9896

99-
```
100-
git submodule add https://github.com/google/docsy.git themes/docsy
97+
2. Add Docsy as a theme via a Git submodule:
98+
99+
```shell
100+
git submodule add --depth 1 https://github.com/google/docsy.git themes/docsy
101+
echo 'theme = "docsy"' >> config.toml
102+
```
103+
104+
3. Install postCSS as [instructed earlier](install-postcss).
105+
106+
4. Get Docsy dependencies:
107+
108+
```shell
109+
(cd themes/docsy && npm install)
110+
```
111+
112+
5. Build or serve your new site using the usual Hugo commands, for example:
113+
114+
```shell
115+
hugo serve
116+
```
117+
118+
To add the Docsy theme to an **existing site**, run the following commands from your
119+
project's root directory:
120+
121+
```sh
122+
git submodule add --depth 1 https://github.com/google/docsy.git themes/docsy
101123
echo 'theme = "docsy"' >> config.toml
102-
git submodule update --init --recursive
124+
(cd themes/docsy && npm install)
103125
```
104126
105-
## Other option 2: Clone the Docsy theme
127+
## Option 2: Clone the Docsy theme
106128
107-
If you don't want to use a submodules (for example, if you want to customize and maintain your own copy of the theme directly, or your deployment choice requires you to include a copy of the theme in your repository), you can clone the theme into your project's `themes` subdirectory.
129+
If you don't want to use a submodules (for example, if you want to customize and
130+
maintain your own copy of the theme directly, or your deployment choice requires
131+
you to include a copy of the theme in your repository), you can clone the theme
132+
into your project's `themes` subdirectory.
108133
109-
To clone Docsy into your project's `theme` folder, run the following commands from your project's root directory:
134+
To clone Docsy into your project's `theme` folder, run the following commands
135+
from your project's root directory:
110136
111-
```
137+
```sh
112138
cd themes
113139
git clone https://github.com/google/docsy
114-
```
115-
116-
If you want to build and/or serve your site [locally](/docs/deployment/#serving-your-site-locally), you also need to get local copies of the theme’s own submodules:
117-
118-
```
119-
git submodule update --init --recursive
140+
cd docsy
141+
npm install
120142
```
121143
122144
For more information, see [Theme Components](https://gohugo.io/hugo-modules/theme-components/) on the [Hugo](https://gohugo.io) site.
@@ -129,8 +151,8 @@ To build and preview your site locally:
129151
cd myproject
130152
hugo server
131153
```
132-
133-
By default, your site will be available at http://localhost:1313/. [See the known issues on MacOS](/docs/get-started/known_issues/#macos).
154+
155+
By default, your site will be available at <http://localhost:1313>. [See the known issues on MacOS](/docs/get-started/known_issues/#macos).
134156
135157
You may get Hugo errors for missing parameters and values when you try to build your site. This is usually because you’re missing default values for some configuration settings that Docsy uses - once you add them your site should build correctly. You can find out how to add configuration in [Basic site configuration](/docs/get-started/basic-configuration/) - we recommend copying the example site configuration even if you’re creating a site from scratch as it provides defaults for many required configuration parameters.
136158

0 commit comments

Comments
 (0)