Skip to content

Commit 2278843

Browse files
author
Andrea Szöllössi
committed
Move content across from alphagov/tdt-documentation
1 parent 552e442 commit 2278843

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1225
-10
lines changed

docs/.ruby-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.5.3

docs/Gemfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
source 'https://rubygems.org'
2+
3+
# For faster file watcher updates on Windows:
4+
gem 'wdm', '~> 0.1.0', platforms: [:mswin, :mingw]
5+
6+
# Windows does not come with time zone data
7+
gem 'tzinfo-data', platforms: [:mswin, :mingw, :jruby]
8+
9+
gem 'govuk_tech_docs', '~> 1.8.0'
10+
11+
gem 'therubyracer'
12+
13+
gem 'middleman-gh-pages'
14+

docs/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Crown Copyright (Government Digital Service)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

docs/README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Tech Docs Template Documentation
2+
3+
[![Build Status](https://travis-ci.org/alphagov/tdt-documentation.svg?branch=master)](https://travis-ci.org/alphagov/tdt-documentation)
4+
5+
This repository is used to generate the [documentation website for the Tech Docs Template][tdt-docs] and uses the template itself.
6+
7+
The Tech Docs Template is a [middleman template][mmt] that
8+
you can use to build technical documentation websites using a GOV.UK style.
9+
10+
## Before you start
11+
12+
To use the Tech Docs Template you need:
13+
14+
- [Ruby][install-ruby]
15+
- [Middleman][install-middleman]
16+
17+
## Making changes
18+
19+
To make changes to the documentation for the Tech Docs Template website, edit files in the `source` folder of this repository.
20+
21+
You can add content by editing the `.html.md.erb` files. These files support content in:
22+
23+
- Markdown
24+
- HTML
25+
- Ruby
26+
27+
👉 You can use Markdown and HTML to [generate different content types][example-content] and [Ruby partials to manage content][partials].
28+
29+
👉 Learn more about [producing more complex page structures][multipage] for your website.
30+
31+
## Preview your changes locally
32+
33+
To preview your new website locally, navigate to your project folder and run:
34+
35+
```sh
36+
bundle exec middleman server
37+
```
38+
39+
👉 See the generated website on `http://localhost:4567` in your browser. Any content changes you make to your website will be updated in real time.
40+
41+
To shut down the Middleman instance running on your machine, use `ctrl+C`.
42+
43+
If you make changes to the `config/tech-docs.yml` configuration file, you need to restart Middleman to see the changes.
44+
45+
## Publishing changes
46+
47+
Travis CI automatically publishes changes merged into the master branch of this repository.
48+
49+
## Troubleshooting
50+
51+
Run `bundle exec middleman build --verbose` to get detailed error messages to help with finding the problem.
52+
53+
## Code of conduct
54+
55+
Please refer to the `alphagov` [code of conduct](https://github.com/alphagov/code-of-conduct).
56+
57+
## Licence
58+
59+
Unless stated otherwise, the codebase is released under the [MIT License](LICENSE). This covers both the codebase and any sample code in the documentation.
60+
The documentation is [© Crown copyright](http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/copyright-and-re-use/crown-copyright/) and available under the terms of the [Open Government 3.0 licence](https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/).
61+
62+
[mmt]: https://middlemanapp.com/advanced/project_templates/
63+
[tdt-docs]: https://tdt-documentation.london.cloudapps.digital
64+
65+
[config]: https://tdt-documentation.london.cloudapps.digital/configuration-options.html#configuration-options
66+
[frontmatter]: https://tdt-documentation.london.cloudapps.digital/frontmatter.html#frontmatter
67+
[multipage]: https://tdt-documentation.london.cloudapps.digital/multipage.html#build-a-multipage-site
68+
[example-content]: https://tdt-documentation.london.cloudapps.digital/content.html#content-examples
69+
[partials]: https://tdt-documentation.london.cloudapps.digital/single_page.html#add-partial-lines
70+
[contribute]: https://github.com/alphagov/tech-docs-gem/blob/master/CONTRIBUTING.md
71+
[install-ruby]: https://tdt-documentation.london.cloudapps.digital/install_macs.html#install-ruby
72+
[install-middleman]: https://tdt-documentation.london.cloudapps.digital/install_macs.html#install-middleman

docs/config.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
require 'govuk_tech_docs'
2+
3+
GovukTechDocs.configure(self, livereload: { js_host: "localhost" })
4+
5+
DOCS_LOCATION_IN_GEM = Bundler.rubygems.find_name('govuk_tech_docs').first.full_gem_path + "/docs"
6+
7+
files.watch :source, path: DOCS_LOCATION_IN_GEM
8+
9+
helpers do
10+
def gem_docs(filename)
11+
raw_markdown = File.read(DOCS_LOCATION_IN_GEM + "/#{filename}")
12+
13+
# Strip the h1 header from the original markdown file
14+
markdown = raw_markdown.lines[1..-1].join
15+
16+
markdown
17+
end
18+
end

docs/config/tech-docs.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Host to use for canonical URL generation (without trailing slash)
2+
host: https://tdt-documentation.london.cloudapps.digital/
3+
4+
# Header-related options
5+
show_govuk_logo: true
6+
service_name: Tech docs template
7+
service_link:
8+
phase: Beta
9+
10+
# Links to show on right-hand-side of header
11+
header_links:
12+
About: https://sites.google.com/a/digital.cabinet-office.gov.uk/gds/communities-of-practice/content/technical-writing
13+
Documentation: /
14+
Support: /
15+
16+
# Table of contents depth – how many levels to include in the table of contents.
17+
# If your ToC is too long, reduce this number and we'll only show higher-level
18+
# headings.
19+
max_toc_heading_level: 2
20+
21+
# Tracking ID from Google Analytics (e.g. UA-XXXX-Y)
22+
ga_tracking_id: UA-86101042-3
23+
24+
google_site_verification: "IJ5HOXpZrISM6la-YO_iX0rBUC5YFftpexygcKLsNs4"
25+
26+
# Multi-page options
27+
multipage_nav: true
28+
collapsible_nav: true
29+
30+
# Show links to contribute on GitHub
31+
show_contribution_banner: true
32+
github_repo: alphagov/tdt-documentation
33+
34+
# Enable search
35+
enable_search: true
36+
37+
# Ownership for page reviews
38+
default_owner_slack: '#docs-repos'
39+
owner_slack_workspace: gds
40+
41+
# Enable GOV.UK crown logo
42+
show_govuk_logo: false

docs/manifest.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
applications:
3+
- name: tdt-documentation
4+
memory: 64M
5+
instances: 2
6+
buildpack: staticfile_buildpack
7+
routes:
8+
- route: tdt-documentation.london.cloudapps.digital

docs/source/api_ref.html.md.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: "API reference"
3+
weight: 80
4+
---
5+
6+
<%= partial 'functionality/api_reference' %>

docs/source/architecture/multipage.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Build a multipage site
2+
3+
You can create a technical documentation site that splits its content across multiple pages.
4+
5+
This is suitable for documentation sites that have too much content for the single page format.
6+
7+
You should use the search feature [link] with multipage documentation sites.
8+
9+
## Basic multipage
10+
11+
You can split the content into multiple individual pages. An example is the [GOV.UK PaaS technical documentation](https://docs.cloud.service.gov.uk/).
12+
13+
### Amend the tech-docs.yml file
14+
15+
Add this to your project’s `tech-docs.yml` file, or set it to true if it is already there:
16+
17+
```
18+
# Enable multipage navigation in the sidebar
19+
multipage_nav: true
20+
```
21+
22+
### Repo folder structure
23+
24+
A typical single page documentation repo has this folder structure:
25+
26+
<br/><br/>
27+
![](/diagrams/Single_page.svg)
28+
<br/><br/>
29+
30+
A basic multipage documentation repo can have this structure:
31+
32+
<br/><br/>
33+
![](/diagrams/Basic_multipage.svg)
34+
<br/><br/>
35+
36+
You must amend the documentation repo folder structure to reflect this structure.
37+
38+
### Create multiple .html.md.erb files
39+
40+
Basic multipage requires multiple `.html.md.erb` files in the tech docs repo __source__ folder.
41+
42+
Each `.html.md.erb` file relates to one separate page within the tech docs, and references the markdown files in the associated folder.
43+
44+
Additionally, the tech doc repo must have at least one `.html.md.erb` file in the __source__ folder named `index.html.md.erb`.
45+
46+
The .html.md.erb files must not have the same name as the folders that the .html.md.erb files use partials refer to.
47+
48+
For example, you cannot have a support.html.md.erb file that contains the partial `<%= partial 'support/contact_us' %>`.
49+
50+
### Amend the multiple .html.md.erb files
51+
52+
1. Add a weight argument and value to the title of each .html.md.erb file. This builds the structure of the multipage documentation.
53+
54+
For example:
55+
56+
```bash
57+
---
58+
title: "Product Technical Documentation"
59+
---
60+
```
61+
62+
becomes
63+
64+
```bash
65+
---
66+
title: "Product Technical Documentation"
67+
weight: 10
68+
---
69+
```
70+
71+
Higher weights mean that the content is lower down in the documentation hierarchy. An easy way to remember this is to think “heavier pages sink to the bottom”.
72+
73+
For example, a single `.html.md.erb` file becomes multiple `.html.md.erb` files:
74+
75+
<div style="height:1px;font-size:1px;">&nbsp;</div>
76+
77+
|Single page|Multipage|
78+
|:---|:---|
79+
|---<br>weight: 10<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/index' %>|---<br>weight: 10<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/index' %>|
80+
||---<br>weight: 10<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/index' %>|
81+
||---<br>weight: 20<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/start' %>|
82+
||---<br>weight: 30<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/users' %>|
83+
84+
<div style="height:1px;font-size:1px;">&nbsp;</div>
85+
86+
### Add H1 heading if required
87+
88+
Add an H1 heading to either the `.html.md.erb` file or at the start of the first markdown file for each individual content page.
89+
90+
If there is an H1 heading in both, you will see two H1s when the documentation site builds and renders in your internet browser.
91+
92+
## Nested multipage
93+
94+
You can split the content into multiple individual pages, and can have pages "nested" within one another. Two examples:
95+
96+
- [GOV.UK PaaS technical documentation - Deploying services](https://docs.cloud.service.gov.uk/deploying_services/)
97+
- [GOV.UK Pay technical documentation - Switching to live](https://docs.payments.service.gov.uk/switching_to_live/#switching-to-live)
98+
99+
### Amend the tech-docs.yml file
100+
101+
Add this to your project’s `tech-docs.yml` file, or set it to true if it is already there:
102+
103+
```
104+
# Enable multipage navigation in the sidebar
105+
multipage_nav: true
106+
```
107+
108+
### Repo folder structure
109+
110+
A typical single page documentation repo has this folder structure:
111+
112+
<br/><br/>
113+
![](/diagrams/Single_page.svg)
114+
<br/><br/>
115+
116+
A nested multipage documentation repo can have this structure:
117+
118+
<br/><br/>
119+
![](/diagrams/Nested_multipage.svg)
120+
<br/><br/>
121+
122+
You must amend the documentation repo folder structure to reflect this structure.
123+
124+
### Create multiple .html.md.erb files
125+
126+
Basic multipage requires multiple `.html.md.erb` files in the tech docs repo __source__ folder.
127+
128+
Each `.html.md.erb` file relates to one separate page within the tech docs, and references the markdown files in the associated folder.
129+
130+
Additionally, the tech doc repo must have at least one `.html.md.erb` file in the __source__ folder named `index.html.md.erb`.
131+
132+
### Amend the multiple .html.md.erb files
133+
134+
1. Add a weight argument and value to the title of each .html.md.erb file. This builds the structure of the multipage documentation.
135+
136+
For example:
137+
138+
```bash
139+
---
140+
title: "Product Technical Documentation"
141+
---
142+
```
143+
144+
becomes
145+
146+
```bash
147+
---
148+
title: "Product Technical Documentation"
149+
weight: 10
150+
---
151+
```
152+
153+
Higher weights mean that the content is lower down in the documentation hierarchy. An easy way to remember this is to think “heavier pages sink to the bottom”.
154+
155+
For example, a single `.html.md.erb` file becomes multiple `.html.md.erb` files:
156+
157+
<div style="height:1px;font-size:1px;">&nbsp;</div>
158+
159+
|Single page|Multipage|
160+
|:---|:---|
161+
|---<br>weight: 10<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/index' %>|---<br>weight: 10<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/index' %>|
162+
||---<br>weight: 10<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/index' %>|
163+
||---<br>weight: 20<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/start' %>|
164+
||---<br>weight: 30<br>title: "Product Technical Documentation"<br>---<br><br><%= partial 'documentation/users' %>|
165+
166+
<div style="height:1px;font-size:1px;">&nbsp;</div>
167+
168+
### Add H1 heading if required
169+
170+
Add an H1 heading to either the `.html.md.erb` file or at the start of the first markdown file for each individual content page.
171+
172+
If there is an H1 heading in both, you will see two H1s when the documentation site builds and renders in your internet browser.
173+
174+
### Create folder for nested content .html.md.erb files
175+
176+
Refer to the GOV.UK PaaS technical documentation repo [nested content folder](https://github.com/alphagov/paas-tech-docs/tree/master/source/deploying_services) as an example.
177+
178+
1. Create a folder within the __source__ folder. This is where the `.html.md.erb` files for your nested content must live.
179+
180+
1. Create an `index.html.md.erb` file within the nested content folder. This will be the "wrapper" for the nested content. It can refer to another content file through partials or have the content in itself.
181+
182+
Note that each `.html.md.erb` must have a weight value that preserves the overall hierarchy both within the nested content and compared to the other non-nested content.
183+
184+
1. Create sub-folders for each nested page under the "wrapper".
185+
186+
1. Create an `index.html.md.erb` file within each sub-folder. Each `.html.md.erb` file can refer to another content file through partials or have the content in itself.
187+
188+
Note that each `.html.md.erb` file must have a weight value that preserves the overall hierarchy both within the nested content and compared to the other non-nested content.
189+
190+
### Add H1 heading if required
191+
192+
Add an H1 heading to either the `.html.md.erb` file or at the start of the first markdown file for each individual content page.
193+
194+
If there is an H1 heading in both, you will see two H1s when the documentation site builds and renders in your internet browser.

0 commit comments

Comments
 (0)