Skip to content

Commit b770b9b

Browse files
committed
More novice friendly + instruction steps now lead to predictable outcome (working docs site)
1 parent ffdb902 commit b770b9b

File tree

1 file changed

+61
-35
lines changed

1 file changed

+61
-35
lines changed
Lines changed: 61 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
11
# Quickstart
22

3-
This quickstart guide will get you going with a docs site for your brand new addon.
3+
This quickstart guide will get you started with a docs site for your brand new
4+
addon. After completion you will have a docs homepage, a docs subpage named
5+
`installation`, an automatically generated API reference and a marketing
6+
homepage you can use to promote your addon.
47

5-
1. **Install the addon.**
8+
1. **Install Addon Docs.**
69

710
```
811
ember install ember-cli-addon-docs
912
```
1013

11-
2. **Add the required routes.** Open `tests/dummy/app/router.js` and add the following route definitions:
14+
2. **Add the docs routes.** Open `tests/dummy/app/router.js` and add the
15+
following route definitions to your main route.
1216

1317
{{#docs-snippet name='quickstart-router.js' title='tests/dummy/app/router.js'}}
14-
this.route('docs', function() {
15-
this.route('api', function() {
16-
this.route('item', { path: '/*path' });
18+
this.route('docs', function() { // docs homepage (required)
19+
this.route('installation'); // docs subpage
20+
this.route('api', function() { // autogenerated API homepage (required)
21+
this.route('item', { path: '/*path' }); // autogenerated API subpages (required)
1722
});
1823
});
1924
{{/docs-snippet}}
2025

21-
3. **Create your app skeleton.** You can add the global keyboard shortcuts component to enable keyboard navigation around your docs site (use `?` to show the help window). Here's our application template:
26+
3. **Create your docs skeleton.** Create a new template for the `docs` route
27+
and make sure it contains the `DocsViewer` component and navigation items for
28+
all docs pages in your site.
2229

23-
{{docs-snippet name="docs-demo-application-template.hbs" title="tests/dummy/app/templates/application.hbs"}}
24-
25-
4. **Create your docs skeleton.** Create a template for the `docs` route and add the DocsViewer component.
26-
27-
{{#docs-snippet name='quickstart-skeleton.hbs' title='tests/dummy/app/pods/docs/template.hbs'}}
30+
{{#docs-snippet name='quickstart-skeleton.hbs' title='tests/dummy/app/templates/docs.hbs'}}
2831
{{#docs-viewer as |viewer|}}
2932

3033
{{#viewer.nav as |nav|}}
31-
{{nav.item 'Overview' 'docs.index'}}
34+
{{nav.item 'Introduction' 'docs.index'}}
35+
{{nav.item 'Installation' 'docs.installation'}}
3236
{{/viewer.nav}}
3337

3438
{{#viewer.main}}
@@ -42,15 +46,36 @@ This quickstart guide will get you going with a docs site for your brand new add
4246
{{/docs-viewer}}
4347
{{/docs-snippet}}
4448

45-
5. **Fill out the index of your docs page.** We called it Overview but you can call it whatever you want. Since Addon Docs supports markdown templates out of the box, we can make this a Markdown file.
49+
4. **Create your documentation sources.** Documentation sources contain the
50+
actual documentation for your addon and live in the folder
51+
`tests/dummy/app/templates/docs`. Since Addon Docs supports Markdown out
52+
of the box we will create two `.md` files (one for your docs `index` and one
53+
for the `installation` page).
4654

47-
{{#docs-snippet name='quickstart-markdown.md' title='tests/dummy/app/templates/docs/index.md' language='markdown'}}
48-
# Overview
55+
{{#docs-snippet name='quickstart-markdown-index.md' title='tests/dummy/app/templates/docs/index.md' language='markdown'}}
56+
# Index
4957

5058
This is my new addon, and it rocks!
5159
{{/docs-snippet}}
5260

53-
6. **Add a 404 route.** Add a route to the end of your router and create an associated template.
61+
{{#docs-snippet name='quickstart-markdown-subpage.md' title='tests/dummy/app/templates/docs/installation.md' language='markdown'}}
62+
# Installation
63+
64+
So easy to install and configure, sweet!
65+
{{/docs-snippet}}
66+
67+
5. **Create your marketing homepage**. Create a new template that will function
68+
as the marketing homepage for your new addon.
69+
70+
{{#docs-snippet name='quickstart-marketing-index.hbs' title='tests/dummy/app/templates/index.hbs'}}
71+
{{#link-to 'docs'}}Docs{{/link-to}}
72+
{{#link-to 'docs.api'}}API Reference{{/link-to}}
73+
74+
My addon marketing page with mind-blowing demo.
75+
{{/docs-snippet}}
76+
77+
6. **Add a 404 route.** Add the following route to the end of your router and
78+
create the associated template.
5479

5580
{{#docs-snippet name='quickstart-404.js' title='tests/dummy/app/router.js'}}
5681
this.route('not-found', { path: '/*path' });
@@ -63,28 +88,29 @@ This quickstart guide will get you going with a docs site for your brand new add
6388
</div>
6489
{{/docs-snippet}}
6590

66-
8. **Add more docs pages.** It's up to you how to structure your docs - use the Snippet, Viewer and Demo components to help you write your documentation. Let's add another page to ours: we'll add the route, link to our docs viewer, and the actual template.
91+
7. **Launch your docs site**. Run `ember serve` and browse to
92+
`localhost:4200/docs` to enjoy your brand new documentation website.
6793

68-
{{#docs-snippet name='quickstart-more-docs.js' title='tests/dummy/app/router.js'}}
69-
this.route('docs', function() {
70-
this.route('installation');
71-
});
72-
{{/docs-snippet}}
94+
8. **Create more pages.** To add more doc pages simply follow the same steps as
95+
used for the `Installation` page in above instructions:
7396

74-
{{#docs-snippet name='quickstart-more-nav.hbs' title='tests/dummy/app/templates/docs.hbs'}}
75-
{{#viewer.nav as |nav|}}
76-
{{nav.item 'Installation' 'docs.installation'}}
77-
{{/viewer.nav}}
78-
{{/docs-snippet}}
97+
- create a docs subroute
98+
- add a navigation item to the `docs` template
99+
- create a new documentation source file (using Markdown, HtmlBars, etc.)
79100

80-
{{#docs-snippet name='quickstart-installation-readme.md' title='tests/dummy/app/templates/docs/installation.md'}}
81-
# Installation
101+
## Optional
82102

83-
To install My Addon, run...
84-
{{/docs-snippet}}
103+
1. **Keyboard navigation.** You may want to enable keyboard navigation for your
104+
docs site by adding the `DocsKeyboardShortcuts` component to your dummy
105+
application template. Once enabled you can use `?` to show the navigation help
106+
windows.
85107

86-
8. **Round out your site.**
108+
{{docs-snippet name="docs-demo-application-template.hbs" title="tests/dummy/app/templates/application.hbs"}}
87109

88-
* **Add a favicon to your dummy app.** We recommend using [Ember CLI Favicon](https://github.com/davewasmer/ember-cli-favicon).
110+
2. **Optional: add a favicon.** You may want to place a favicon in the
111+
`tests/dummy/public` folder. We recommend using using
112+
[Ember CLI Favicon](https://github.com/davewasmer/ember-cli-favicon).
89113

90-
* **Install [Ember Router Scroll](https://github.com/dollarshaveclub/ember-router-scroll).**
114+
3. **Optional: better scrolling.** You may want to install
115+
[Ember Router Scroll](https://github.com/dollarshaveclub/ember-router-scroll)
116+
to enable "scroll to top with preserved browser history scroll position".

0 commit comments

Comments
 (0)