|
1 | | -# Docsy Jekyll Theme |
| 1 | +# Docsy Example |
2 | 2 |
|
3 | | -[](https://circleci.com/gh/vsoch/docsy-jekyll/tree/master) |
4 | | -<a href="https://jekyll-themes.com/docsy-jekyll/"> |
5 | | - <img src="https://img.shields.io/badge/featured%20on-JT-red.svg" height="20" alt="Jekyll Themes Shield" > |
6 | | -</a> |
| 3 | +[Docsy](https://github.com/google/docsy) is a Hugo theme for technical documentation sites, providing easy site navigation, structure, and more. This **Docsy Example Project** uses the Docsy theme, as well as providing a skeleton documentation structure for you to use. You can either copy this project and edit it with your own content, or use the theme in your projects like any other [Hugo theme](https://gohugo.io/themes/installing-and-using-themes/). |
7 | 4 |
|
8 | | - |
| 5 | +The theme is included in this project as a Git submodule: |
9 | 6 |
|
10 | | -This is a [starter template](https://vsoch.github.com/docsy-jekyll/) for a Docsy jekyll theme, based |
11 | | -on the Beautiful [Docsy](https://github.com/google/docsy) that renders with Hugo. This version is intended for |
12 | | -native deployment on GitHub pages. The original [Apache License](https://github.com/vsoch/docsy-jekyll/blob/master/LICENSE) is included. |
13 | | - |
14 | | -## Changes |
| 7 | +```bash |
| 8 | +▶ git submodule |
| 9 | + a053131a4ebf6a59e4e8834a42368e248d98c01d themes/docsy (heads/master) |
| 10 | +``` |
15 | 11 |
|
16 | | -The site is intended for purely documentation, so while the front page banner |
17 | | -is useful for business or similar, this author (@vsoch) preferred to have |
18 | | -the main site page go directly to the Documentation view. Posts |
19 | | -are still provided via a feed. |
| 12 | +This Docsy Example Project is hosted at [https://example.docsy.dev/](https://example.docsy.dev/). |
20 | 13 |
|
21 | | -## Usage |
| 14 | +You can find detailed theme instructions in the Docsy user guide: https://docsy.dev/docs/ |
22 | 15 |
|
23 | | -### 1. Get the code |
| 16 | +This is not an officially supported Google product. This project is currently maintained. |
24 | 17 |
|
25 | | -You can clone the repository right to where you want to host the docs: |
| 18 | +## Using the Docsy Example Project as a template |
26 | 19 |
|
27 | | -```bash |
28 | | -git clone https://github.com/vsoch/docsy-jekyll.git docs |
29 | | -cd docs |
30 | | -``` |
| 20 | +A simple way to get started is to use this project as a template, which gives you a site project that is set up and ready to use. To do this: |
31 | 21 |
|
32 | | -### 2. Customize |
| 22 | +1. Click **Use this template**. |
33 | 23 |
|
34 | | -To edit configuration values, customize the [_config.yml](https://github.com/vsoch/docsy-jekyll/blob/master/_config.yml). |
35 | | -To add pages, write them into the [pages](https://github.com/vsoch/docsy-jekyll/blob/master/pages) folder. |
36 | | -You define urls based on the `permalink` attribute in your pages, |
37 | | -and then add them to the navigation by adding to the content of [_data/toc.myl](https://github.com/vsoch/docsy-jekyll/blob/master/_data/toc.yml). |
38 | | -The top navigation is controlled by [_data/navigation.yml](https://github.com/vsoch/docsy-jekyll/blob/master/_data/navigation.yml) |
| 24 | +2. Select a name for your new project and click **Create repository from template**. |
39 | 25 |
|
40 | | -### 3. Options |
| 26 | +3. Make your own local working copy of your new repo using git clone, replacing https://github.com/my/example.git with your repo’s web URL: |
41 | 27 |
|
42 | | -Most of the configuration values in the [_config.yml](https://github.com/vsoch/docsy-jekyll/blob/master/_config.yml) are self explanatory, |
43 | | -and for more details, see the [getting started page](https://vsoch.github.io/docsy-jekyll/docs/getting-started) |
44 | | -rendered on the site. |
| 28 | +```bash |
| 29 | +git clone --recurse-submodules --depth 1 https://github.com/my/example.git |
| 30 | +``` |
45 | 31 |
|
46 | | -### 4. Serve |
| 32 | +You can now edit your local versions of the site’s source files. |
47 | 33 |
|
48 | | -Depending on how you installed jekyll: |
| 34 | +If you want to do SCSS edits and want to publish these, you need to install `PostCSS` |
49 | 35 |
|
50 | 36 | ```bash |
51 | | -jekyll serve |
52 | | -# or |
53 | | -bundle exec jekyll serve |
| 37 | +npm install |
54 | 38 | ``` |
55 | 39 |
|
56 | | -### 5. Run as a container in dev or prod |
| 40 | +## Running the website locally |
57 | 41 |
|
58 | | -#### Software Dependencies |
| 42 | +Once you've cloned or copied the site repo, from the repo root folder, run: |
59 | 43 |
|
60 | | -If you want to run docsy jekyll via a container for development (dev) or production (prod) you can use containers. This approach requires installing [docker-ce](https://docs.docker.com/engine/install/ubuntu/) and [docker-compose](https://docs.docker.com/compose/install/). |
| 44 | +``` |
| 45 | +hugo server |
| 46 | +``` |
61 | 47 |
|
62 | | -#### Customization |
| 48 | +## Running a container locally |
63 | 49 |
|
64 | | -Note that the [docker-compose.yml](docker-compose.yml) file is using the [jekyll/jekyll:3.8](https://hub.docker.com/r/jekyll/jekyll/tags) image. If you want to make your build more reproducible, you can specify a particular version for jekyll (tag). Note that at the development time of writing this documentation, the latest was tag 4.0.0, |
65 | | -and it [had a bug](https://github.com/fastai/fastpages/issues/267#issuecomment-620612896) that prevented the server from deploying. |
| 50 | +You can run docsy-example inside a [Docker](ihttps://docs.docker.com/) |
| 51 | +container, the container runs with a volume bound to the `docsy-example` |
| 52 | +folder. This approach doesn't require you to install any dependencies other |
| 53 | +than Docker. |
66 | 54 |
|
67 | | -If you are deploying a container to production, you should remove the line to |
68 | | -mount the bundles directory to the host in the docker-compose.yml. Change: |
| 55 | +1. Build the docker image |
69 | 56 |
|
70 | | -```yaml |
71 | | - volumes: |
72 | | - - "./:/srv/jekyll" |
73 | | - - "./vendor/bundle:/usr/local/bundle" |
74 | | - # remove "./vendor/bundle:/usr/local/bundle" volume when deploying in production |
| 57 | +```bash |
| 58 | +docker build -f dev.Dockerfile -t docsy-example-dev:latest . |
75 | 59 | ``` |
76 | 60 |
|
77 | | -to: |
| 61 | +1. Run the built image |
78 | 62 |
|
79 | | -```yaml |
80 | | - volumes: |
81 | | - - "./:/srv/jekyll" |
| 63 | +```bash |
| 64 | +docker run --publish 1313:1313 --detach --mount src="$(pwd)",target=/home/docsy/app,type=bind docsy-example-dev:latest |
82 | 65 | ``` |
83 | 66 |
|
84 | | -This additional volume is optimal for development so you can cache the bundle dependencies, |
85 | | -but should be removed for production. |
| 67 | +Open your web browser and type `http://localhost:1313` in your navigation bar, |
| 68 | +This opens a local instance of the docsy-example homepage. You can now make |
| 69 | +changes to the docsy example and those changes will immediately show up in your |
| 70 | +browser after you save. |
| 71 | + |
| 72 | +To stop the container, first identify the container ID with: |
86 | 73 |
|
87 | | -#### Start Container |
| 74 | +```bash |
| 75 | +docker container ls |
| 76 | +``` |
88 | 77 |
|
89 | | -Once your docker-compose to download the base container and bring up the server: |
| 78 | +Take note of the hexadecimal string below the `CONTAINER ID` column, then stop |
| 79 | +the container: |
90 | 80 |
|
91 | 81 | ```bash |
92 | | -docker-compose up -d |
| 82 | +docker stop [container_id] |
93 | 83 | ``` |
94 | 84 |
|
95 | | -You can then open your browser to [http://localhost:4000](http://localhost:4000) |
96 | | -to see the server running. |
| 85 | +To delete the container run: |
97 | 86 |
|
98 | | -> Node : changes `baseurl: ""` in _config.yml when you are running in local and prod according to the requirement. |
| 87 | +``` |
| 88 | +docker container rm [container_id] |
| 89 | +``` |
0 commit comments