middleman-pagegroups 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/CHANGELOG.md +6 -0
  4. data/Gemfile +18 -0
  5. data/LICENSE.md +22 -0
  6. data/README.md +87 -0
  7. data/Rakefile +10 -0
  8. data/bin/middleman-pagegroups +108 -0
  9. data/documentation_project/.gitignore +25 -0
  10. data/documentation_project/Gemfile +18 -0
  11. data/documentation_project/README.md +13 -0
  12. data/documentation_project/config.rb +109 -0
  13. data/documentation_project/source/documentation/10_concepts.html.md.erb +111 -0
  14. data/documentation_project/source/documentation/20_directory_organization.html.md.erb +85 -0
  15. data/documentation_project/source/documentation/30_frontmatter.html.md.erb +70 -0
  16. data/documentation_project/source/documentation/40_resources.html.md.erb +79 -0
  17. data/documentation_project/source/documentation/50_helpers.html.md.erb +252 -0
  18. data/documentation_project/source/documentation/60_sample_partials.html.md.erb +55 -0
  19. data/documentation_project/source/documentation/70_sample_layouts.html.md.erb +92 -0
  20. data/documentation_project/source/documentation/80_config.html.md.erb +98 -0
  21. data/documentation_project/source/documentation/index.html.md.erb +32 -0
  22. data/documentation_project/source/documentation/ovum.html.md.erb +27 -0
  23. data/documentation_project/source/fonts/font-awesome/FontAwesome.otf +0 -0
  24. data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.eot +0 -0
  25. data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.svg +655 -0
  26. data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.ttf +0 -0
  27. data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.woff +0 -0
  28. data/documentation_project/source/fonts/font-awesome/fontawesome-webfont.woff2 +0 -0
  29. data/documentation_project/source/images/middleman-pagegroups-small.png +0 -0
  30. data/documentation_project/source/images/middleman-pagegroups.png +0 -0
  31. data/documentation_project/source/index.html.md.erb +39 -0
  32. data/documentation_project/source/javascripts/all.js +1 -0
  33. data/documentation_project/source/layouts/layout.haml +11 -0
  34. data/documentation_project/source/layouts/template-logo-large.haml +25 -0
  35. data/documentation_project/source/layouts/template-logo-medium.haml +26 -0
  36. data/documentation_project/source/layouts/template-logo-small.haml +26 -0
  37. data/documentation_project/source/license.html.md.erb +29 -0
  38. data/documentation_project/source/partials/_nav_breadcrumbs.haml +11 -0
  39. data/documentation_project/source/partials/_nav_breadcrumbs_alt.haml +15 -0
  40. data/documentation_project/source/partials/_nav_brethren.haml +18 -0
  41. data/documentation_project/source/partials/_nav_brethren_index.haml +14 -0
  42. data/documentation_project/source/partials/_nav_legitimate_children.haml +16 -0
  43. data/documentation_project/source/partials/_nav_prev_next.haml +21 -0
  44. data/documentation_project/source/partials/_nav_toc_index.haml +21 -0
  45. data/documentation_project/source/stylesheets/_github.scss +61 -0
  46. data/documentation_project/source/stylesheets/_middlemac_minimal.scss +668 -0
  47. data/documentation_project/source/stylesheets/_normalize.scss +374 -0
  48. data/documentation_project/source/stylesheets/breadcrumb-separator-light.png +0 -0
  49. data/documentation_project/source/stylesheets/style.css.scss +3 -0
  50. data/documentation_project/source/toc.html.md.erb +26 -0
  51. data/lib/middleman-pagegroups/extension.rb +431 -0
  52. data/lib/middleman-pagegroups/partials.rb +173 -0
  53. data/lib/middleman-pagegroups/version.rb +5 -0
  54. data/lib/middleman-pagegroups.rb +6 -0
  55. data/middleman-pagegroups.gemspec +26 -0
  56. metadata +140 -0
@@ -0,0 +1,70 @@
1
+ ---
2
+ title: Front Matter
3
+ id: frontmatter
4
+ blurb: Front matter controls features such as navigation, and can be used
5
+ to control page sort order.
6
+ layout: template-logo-medium
7
+ navigator: true
8
+ ---
9
+
10
+ # <%= current_page.data.title %>
11
+
12
+ <%= current_page.data.blurb %>
13
+
14
+ Using some of these new front matter keys will make implementing automatic
15
+ navigation features much, much easier for you. This is a description of the
16
+ keys.
17
+
18
+ `blurb`
19
+
20
+ : Specifying a blurb for your pages make tables of content more interesting,
21
+ as they can automatically include a brief summary about that particular
22
+ page. Suitably written blurbs can even be included in their own pages,
23
+ such as the opening paragraph if this page.
24
+
25
+ Note that if you want HTML features in your blurbs, then they must be
26
+ written in HTML. Middleman doesn’t process front matter, and so markdown
27
+ can’t be used.
28
+ {:.note}
29
+
30
+ `navigate`
31
+
32
+ : When used with group `index.html` pages, it indicates that its legitimate
33
+ children should implement a page navigator (previous and next page controls)
34
+ if they are eligible.
35
+
36
+ The default is `false`.
37
+
38
+ As done in this sample documentation project’s templates, a check using
39
+ the [resource](resources) `current_page.navigator_eligible?` will determine
40
+ that the group is enabled via `navigate` and then add the navigation control
41
+ to eligible pages.
42
+
43
+ `navigator`
44
+
45
+ : When used in any of your pages, it indicates that a page navigator (previous
46
+ and next page controls) should be implemented if the page is eligible.
47
+
48
+ The default is `true`; this means you only have to use this key to exclude
49
+ an otherwise legitimate page.
50
+
51
+ As done in this sample documentation project’s templates, a check using
52
+ the [resource](resources) `current_page.navigator_eligible?` will determine
53
+ that the group is enabled via `navigate` and then add the navigation control
54
+ to eligible pages.
55
+
56
+ `order`
57
+
58
+ : Use this key to specify the order that the page appears in the various
59
+ helpers and partials. This key is required for any `index.html` (except for
60
+ the root item), and optional if you prefer to number your pages using
61
+ [filename prefixes](directory_organization).
62
+
63
+ All pages eligible for automatic navigation must have an order set via one
64
+ method or another. Pages without an order are still included, of course,
65
+ and you can link to them as usual.
66
+
67
+ Sort order is any integer, and sort order does not have to be consecutive.
68
+ Sometimes it’s helpful to leave large gaps in order to simplify future
69
+ insertions. (You can use `current_page.page_sequence` to generate page
70
+ numbers.)
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: Resources
3
+ id: resources
4
+ blurb: You will use resource methods to design your own partials and templates.
5
+ layout: template-logo-medium
6
+ navigator: true
7
+ ---
8
+
9
+ # <%= current_page.data.title %>
10
+
11
+ The built-in resource additions can be useful in designing your own
12
+ partials, templates, and helpers.
13
+
14
+ ## Resources
15
+
16
+ Resource extensions are usually accessed in your templates, partials, and
17
+ helpers with `current_page`, and so the descriptions below will use this as an
18
+ example. However keep in mind that these methods apply to _any_ resource.
19
+
20
+ `current_page.breadcrumbs`
21
+
22
+ : Returns an array of pages leading to the specified page.
23
+
24
+ `current_page.brethren`
25
+
26
+ : Returns an array of all of the legitimate siblings of the specified page,
27
+ returning them by ascending sort order.
28
+
29
+ `current_page.brethren_next`
30
+
31
+ : Returns the next legitimate sibling of the specified page, or `nil` if it’s
32
+ already the last page.
33
+
34
+ `current_page.brethren_previous`
35
+
36
+ : Returns the previous legitimate sibling of the specified page, or `nil` if
37
+ it’s already the first page.
38
+
39
+ `current_page.group_count`
40
+
41
+ : Indicates the number of pages that are in the current group.
42
+
43
+ `current_page.legitimate_children`
44
+
45
+ : Returns an array of all of the specified page’s legitimate children, sorted
46
+ in ascending order by their sort order.
47
+
48
+ `current_page.navigator_eligible?`
49
+
50
+ : Indicates whether or not the page is eligible for displaying a previous/next
51
+ page indicator. It’s eligible if all of these conditions are met:
52
+
53
+ - Its parent has front matter key `navigate` set to true.
54
+ - It does _not_ have a front matter key `navigator` set to false.
55
+ - It’s a legitimate page, i.e., has a sort order, not ignored, etc.
56
+
57
+ `current_page.page_group`
58
+
59
+ : Indicates the name of the current page group. This can be useful for setting
60
+ up CSS and performing conditional tasks. The name of the group is simply
61
+ the name of the containing directory. Group names might not be unique.
62
+
63
+ `current_page.page_name`
64
+
65
+ : Indicates the name of the current page. This can be useful for setting up
66
+ CSS and performing conditional tasks. The name of the page is simply the
67
+ output page name without an extension. Page names might not be unique.
68
+
69
+ `current_page.page_sequence`
70
+
71
+ : Indicates the sequence of the page within its group, starting with one. You
72
+ might use this directly as a page number, or use it indirectly if your page
73
+ numbers don’t start at one.
74
+
75
+ Pages without sort orders will return `nil` for this value.
76
+
77
+ `current_page.sort_order`
78
+
79
+ : Indicates the sort order of the page, or 0 if no order has been assigned.
@@ -0,0 +1,252 @@
1
+ ---
2
+ title: Helpers
3
+ id: helpers
4
+ blurb: You will use helpers to design your own partials and templates, and
5
+ to produce automatic navigation output.
6
+ layout: template-logo-medium
7
+ navigator: true
8
+ ---
9
+
10
+ # <%= current_page.data.title %>
11
+
12
+ This extension extends one of Middleman’s built-in helpers, as well as provides
13
+ helpers to access some of the extension defaults within your helpers, partials,
14
+ and pages. Also included are several helpers that generate reasonable automatic
15
+ navigation output into your pages.
16
+
17
+ ## Extended Helpers
18
+
19
+ Some of Middleman’s built-in helpers are extended in order to offer more
20
+ features.
21
+
22
+ `page_classes`
23
+
24
+ : If you’ve enabled `extend_page_class` in your [`config.rb`](config)
25
+ file, then `middleman-pagegroups` will add the current `page_name` and
26
+ `page_group` to the `page_classes` output. Default Middleman project
27
+ templates include this as the `<body class="…"` content.
28
+
29
+ Here is the result of `page_classes` right now: `<%= page_classes %>`
30
+
31
+
32
+ ## Access to Extension Configuration Settings
33
+
34
+ [Configuration settings](config) that are useful for the output-producing
35
+ helpers and for the default partials are exposed via helpers. They are shown
36
+ below, and the current values for this project are shown as an example.
37
+
38
+ `nav_breadcrumbs_class`
39
+
40
+ : Exposes `nav_breadcrumbs_class`, currently `<%= nav_breadcrumbs_class %>`
41
+
42
+ `nav_breadcrumbs_alt_class`
43
+
44
+ : Exposes `nav_breadcrumbs_alt_class`, currently `<%= nav_breadcrumbs_alt_class %>`
45
+
46
+ `nav_breadcrumbs_alt_label`
47
+
48
+ : Exposes `nav_breadcrumbs_alt_label`, currently `<%= nav_breadcrumbs_alt_label %>`
49
+
50
+ `nav_brethren_class`
51
+
52
+ : Exposes `nav_brethren_class`, currently `<%= nav_brethren_class %>`
53
+
54
+ `nav_brethren_index_class`
55
+
56
+ : Exposes `nav_brethren_index_class`, currently `<%= nav_brethren_index_class %>`
57
+
58
+ `nav_legitimate_children_class`
59
+
60
+ : Exposes `nav_legitimate_children_class`, currently `<%= nav_legitimate_children_class %>`
61
+
62
+ `nav_prev_next_class`
63
+
64
+ : Exposes `nav_prev_next_class`, currently `<%= nav_prev_next_class %>`
65
+
66
+ `nav_prev_next_label_prev`
67
+
68
+ : Exposes `nav_prev_next_label_prev`, currently `<%= nav_prev_next_label_prev %>`
69
+
70
+ `nav_prev_next_label_next`
71
+
72
+ : Exposes `nav_prev_next_label_next`, currently `<%= nav_prev_next_label_next %>`
73
+
74
+ `nav_toc_index_class`
75
+
76
+ : Exposes `nav_breadcrumbs_alt_class`, currently `<%= nav_breadcrumbs_alt_class %>`
77
+
78
+ Note that these are all read-only. These aren’t variables; they’re helpers, and
79
+ they are simply providing a variable value to you.
80
+ {:.note}
81
+
82
+ ## Output Helpers
83
+
84
+ Output helpers generate most of the automatic navigation features. They’re handy
85
+ to use, but you may consider using the [partials](partials) instead, or writing
86
+ your own.
87
+
88
+ Each of these helpers accepts an optional parameter called `locals` which, if
89
+ used, must be a hash. For the locals to be useful, the hash must consist of
90
+ useful key value pairs.
91
+
92
+ All of the helpers accept a `:class` or `:klass` local. If present then the
93
+ navigation feature enclose `div` will be set to that class, otherwise the
94
+ default from your [config.rb](config) will be used.
95
+
96
+ Middleman geek knowledge: these helpers are implemented internally as partials
97
+ using the same code as used to generate the sample partials, except for
98
+ `nav_toc_index` which has some tricky recursion. This keeps things DRY, and
99
+ is the reason that the parameter is referred to a `locals`. It’s also the
100
+ reason that we have to internally use `klass` instead of `class`.
101
+ {:.note}
102
+
103
+ For each helper below, the information shown consists of:
104
+
105
+ - A brief description of the helper.
106
+ - A description of the `locals` keys that can be used.
107
+ - Sample HTML output, generated from using the helper in this project.
108
+
109
+ * * *
110
+
111
+ ### `nav_breadcrumbs( locals )`
112
+
113
+ Generate a breadcrumbs structure as an `<ul>`. The trailing element is
114
+ the current page.
115
+
116
+ `:class`
117
+
118
+ : Specify the class of the containing `<div>`.
119
+
120
+ ~~~ html
121
+ <%= nav_breadcrumbs %>
122
+ ~~~
123
+
124
+ * * *
125
+
126
+ ### `nav_breadcrumbs_alt( locals )`
127
+
128
+ Generate the breadcrumbs structure, alternate form, wherein the trailing element
129
+ consists of a label indicating “current page,” as an `<ul>`.
130
+
131
+ `:class`
132
+
133
+ : Specify the class of the containing `<div>`.
134
+
135
+ `:label`
136
+
137
+ : Specify the label to use to mark the current page.
138
+
139
+ ~~~ html
140
+ <%= nav_breadcrumbs_alt %>
141
+ ~~~
142
+
143
+ * * *
144
+
145
+ ### `nav_brethren( locals )`
146
+
147
+ Generate a fuller list of related topics, including blurbs if present, as a
148
+ `<dl>`.
149
+
150
+ `:class`
151
+
152
+ : Specify the class of the containing `<div>`.
153
+
154
+ `:start`
155
+
156
+ : The resource from which to start the list, e.g., `current_page` or
157
+ `current_page.breadcrumbs.first`, or some other resource. The default will
158
+ always be `current_page` if this local is not declared.
159
+
160
+ ~~~ html
161
+ <%= nav_brethren %>
162
+ ~~~
163
+
164
+ * * *
165
+
166
+ ### `nav_brethren_index( locals )`
167
+
168
+ Generates a condensed list of brethren, omitting blurbs, as a `<dl>`.
169
+
170
+ `:class`
171
+
172
+ : Specify the class of the containing `<div>`.
173
+
174
+ `:start`
175
+
176
+ : The resource from which to start the list, e.g., `current_page` or
177
+ `current_page.breadcrumbs.first`, or some other resource. The default will
178
+ always be `current_page` if this local is not declared.
179
+
180
+ ~~~ html
181
+ <%= nav_brethren_index %>
182
+ ~~~
183
+
184
+ * * *
185
+
186
+ ### `nav_legitimate_children( locals )`
187
+
188
+ Generate a fuller list of related topics, including blurbs if present, as a
189
+ `<dl>`.
190
+
191
+ `:class`
192
+
193
+ : Specify the class of the containing `<div>`.
194
+
195
+ `:start`
196
+
197
+ : The resource from which to start the list, e.g., `current_page` or
198
+ `current_page.breadcrumbs.first`, or some other resource. The default will
199
+ always be `current_page` if this local is not declared.
200
+
201
+ ~~~ html
202
+ <%= nav_legitimate_children :start => current_page.breadcrumbs.first %>
203
+ ~~~
204
+
205
+ Because this page has no children at all, the example output above shows output
206
+ using `:start => current_page.breadcrumbs.first`. You will note, though, that
207
+ because it was generated on _this_ page, all of the links appropriately reflect
208
+ the correct path to get to those pages from _here_.
209
+ {:.note}
210
+
211
+ * * *
212
+
213
+ ### `nav_prev_next( locals )`
214
+
215
+ Generate a previous and next button as two anchors nested within a `<div>`.
216
+
217
+ `:class`
218
+
219
+ : Specify the class of the containing `<div>`.
220
+
221
+ `:label_previous`
222
+
223
+ : Label for previous button.
224
+
225
+ `:label_next`
226
+
227
+ : Label for next button.
228
+
229
+ ~~~ html
230
+ <%= nav_prev_next %>
231
+ ~~~
232
+
233
+ * * *
234
+
235
+ ### `nav_toc_index( locals )`
236
+
237
+ Generate a nested `<ul>` structure representing the complete table of contents
238
+ from any particular starting point.
239
+
240
+ `:class`
241
+
242
+ : Specify the class of the containing `<div>`.
243
+
244
+ `:start`
245
+
246
+ : The resource from which to start the index, e.g., `current_page` or
247
+ `current_page.breadcrumbs.first`, or some other resource. The default will
248
+ always be `current_page` if this local is not declared.
249
+
250
+ ~~~ html
251
+ <%= nav_toc_index :start => current_page.breadcrumbs.first %>
252
+ ~~~
@@ -0,0 +1,55 @@
1
+ ---
2
+ title: Sample Partials
3
+ id: partials
4
+ blurb: A look at the included sample partials available with <code>middleman-pagegroups</code>.
5
+ layout: template-logo-medium
6
+ navigator: true
7
+ ---
8
+
9
+ # <%= current_page.data.title %>
10
+
11
+ Although `middleman-pagegroups` has a useful set of [helpers](helpers), you can
12
+ use its sample partials instead. This gives you the obvious ability to customize
13
+ them to suit your own needs.
14
+
15
+ For convenience you can find them in this sample project’s `source/partials/`
16
+ directory, or you can generate them on demand if `middleman-pagegroups` gem is
17
+ installed:
18
+
19
+ ~~~ bash
20
+ middleman-pagegroups partials <directory>
21
+ ~~~
22
+
23
+ If you don’t specify a `<directory`> then the files will be placed into your
24
+ current working directory.
25
+
26
+ ## The partials
27
+
28
+ The partials are named identically to the [helpers of the same name](helpers),
29
+ and they work identically and take the same optional `locals` parameters. For
30
+ details of these partials, the links lead to [Helpers](helpers).
31
+
32
+ **Caveat**: the `locals` parameters work _almost_ the same. For partials, you
33
+ must **not** use `:class`; use `:klass` instead. This is a limitation due to
34
+ the way that Middleman (really, Padrino) implements partials. These `locals`
35
+ become actual, local variables in the helpers, and the word “class” is not a
36
+ valid local variable name (it’s a reserved word).
37
+ {:.note}
38
+
39
+ * * *
40
+
41
+ - [`_nav_breadcrumbs.haml`](helpers.html#navbreadcrumbs-locals-)
42
+ - [`_nav_breadcrumbs_alt.haml`](helpers.html#navbreadcrumbsalt-locals-)
43
+ - [`_nav_brethren_index.haml`](helpers.html#navbrethren-locals-)
44
+ - [`_nav_brethren.haml`](helpers.html#navbrethrenindex-locals-)
45
+ - [`_nav_legitimate_children.haml`](helpers.html#navlegitimatechildren-locals-)
46
+ - [`_nav_prev_next.haml`](helpers.html#navprevnext-locals-)
47
+ - [`_nav_toc_index.haml`](helpers.html#navtocindex-locals-)
48
+
49
+ * * *
50
+
51
+ Middleman geek knowledge: when you generate partials using the
52
+ `middleman-pagegroups partials` command, it’s not just a file copy. The partials
53
+ are generated from the same source code that is used by the helpers, except for
54
+ `_nav_toc_index.haml` which has some tricky recursion going on.
55
+ {:.note}
@@ -0,0 +1,92 @@
1
+ ---
2
+ title: Sample Layouts
3
+ id: layouts
4
+ blurb: The sample layouts are good models for integrating <code>middleman-pagegroups</code>
5
+ in your own projects. Let’s have a look.
6
+ layout: template-logo-medium
7
+ navigator: true
8
+ ---
9
+
10
+ # <%= current_page.data.title %>
11
+
12
+ To get the most benefit from `middleman-pagegroups` you will most likely want
13
+ to use [partials](partials) and/or [helpers](helpers) in your layouts. This
14
+ sample project does such.
15
+
16
+ Let’s examine a couple of examples from this very project.
17
+
18
+
19
+ ## `template-logo-medium`
20
+
21
+ Most of this site’s pages use this layout.
22
+
23
+ ~~~ haml
24
+ = wrap_layout ('layout'.to_sym) do
25
+ .container-logo-medium
26
+ %div
27
+ .yield-content
28
+ ~ yield
29
+ - if current_page.navigator_eligible?
30
+ %hr
31
+ = nav_prev_next
32
+
33
+ %div
34
+ %div
35
+ = image_tag 'middleman-pagegroups-small.png', :alt => 'middleman-pagegroups logo'
36
+ .related_topics
37
+ %h1 Related Topics
38
+ = nav_brethren_index
39
+
40
+ - if content_for?(:seeAlso)
41
+ %h1 See Also
42
+ = yield_content :seeAlso
43
+ ~~~
44
+
45
+ We can immediately see that this layout is wrapped by another layout, `layout`,
46
+ that we’ll look at shortly. Within this file are two interesting sections:
47
+
48
+ ~~~ haml
49
+ - if current_page.navigator_eligible?
50
+ %hr
51
+ = nav_prev_next
52
+ ~~~
53
+
54
+ This checks the current page with the `resource.navigator_eligible?` method,
55
+ and then includes the navigation controls using the `nav_prev_next` helper if
56
+ it’s so. This page (the one you’re looking at), includes the navigator controls
57
+ as a result of this code.
58
+
59
+ Next, this code:
60
+
61
+ ~~~ haml
62
+ %h1 Related Topics
63
+ = nav_brethren_index
64
+ ~~~
65
+
66
+ …provides all of the Related Topics for every page of this site using this
67
+ template (which is most of them).
68
+
69
+ Have a look at `template-logo-large` and `template-logo-small` to find similar
70
+ code.
71
+
72
+
73
+ ## `layout`
74
+
75
+ The `layout.haml` provides the outer wrapper for every page of this
76
+ documentation. Aside from providing all of the required HTML boiler plate, it
77
+ contains some interesting code:
78
+
79
+ ~~~ haml
80
+ %body{:class => "#{page_classes}"}
81
+ %nav#breadcrumbs
82
+ = nav_breadcrumbs_alt
83
+ = yield
84
+ ~~~
85
+
86
+ First, it uses the `page_classes` helper that Middleman projects do by default,
87
+ but in this case the `page_name` and `page_group` will be included. This isn’t
88
+ used by any CSS in this particular project, but it’s available when needed.
89
+
90
+ Also because this is the outer wrapper for every page, it's a good place to
91
+ add the breadcrumbs navigator at the top of the page, using the
92
+ `nav_breadcrumbs_alt` helper.
@@ -0,0 +1,98 @@
1
+ ---
2
+ title: Setting up <code>Gemfile</code> and <code>config.rb</code>
3
+ id: config
4
+ blurb: Your <code>Gemfile</code> and <code>config.rb</code> files are where
5
+ you specify your project’s settings.
6
+ layout: template-logo-medium
7
+ navigator: true
8
+ ---
9
+
10
+ # <%= current_page.data.title %>
11
+
12
+ Most things happen automatically without any configuration, but as with
13
+ Middleman itself, there are some things to be setup before you can use it.
14
+
15
+ ## `Gemfile`
16
+
17
+ To ensure that your Middleman project can use `middleman-pagegroups`, make sure
18
+ you add it to your `Gemfile`:
19
+
20
+ ~~~ ruby
21
+ gem 'middleman-pagegroups'
22
+ ~~~
23
+
24
+ ## `config.rb`
25
+
26
+ To use the features provided by `middleman-pagegroups` you have to ensure that
27
+ it’s activated in your `config.rb` file, first:
28
+
29
+ ~~~ ruby
30
+ activate :MiddlemanPageGroups
31
+ ~~~
32
+
33
+ Note that if you are using other Middleman extensions that make modifications to
34
+ the resource list – particularly if they remove things – you will want to ensure
35
+ that they are activated before `:MiddlemanPageGroups`.
36
+ {:.note}
37
+
38
+ If you are using other Middleman extensions that read from the resource list –
39
+ particularly things that count on correct page locations – you will want to
40
+ ensure that they are activated _after_ `:MiddlemanPageGroups`.
41
+ {:.note}
42
+
43
+ A more interesting way to active `middleman-pagegroups` is with a block, which
44
+ gives you the opportunity to setup options:
45
+
46
+ ~~~ ruby
47
+ activate :MiddlemanPageGroups do |config|
48
+
49
+ # Indicate whether or not numeric file name prefixes used for sorting
50
+ # pages should be eliminated during output. This results in cleaner
51
+ # URI's. Helpers such as `page_name` and Middleman helpers such as
52
+ # `page_class` will reflect the pretty name.
53
+ config.strip_file_prefixes = true
54
+
55
+ # Indicates whether or not Middleman's built-in `page_class` helper is
56
+ # extended to include the page_group and page_name.
57
+ config.extend_page_class = true
58
+
59
+ # the following options provide defaults for the built-in helpers, and
60
+ # also work with the sample partials if you choose to install them.
61
+ # They'll also work in your own partials and helpers, of course.
62
+
63
+ # Default css class for the nav_breadcrumbs helper/partial.
64
+ config.nav_breadcrumbs_class = 'breadcrumbs'
65
+
66
+ # Default css class for the nav_breadcrumbs_alt helper/partial.
67
+ config.nav_breadcrumbs_alt_class = 'breadcrumbs'
68
+
69
+ # Default "current page" label for the nav_breadcrumbs_alt helper/partial.
70
+ config.nav_breadcrumbs_alt_label = 'Current page'
71
+
72
+ # Default css class for the nav_brethren helper/partial.
73
+ config.nav_brethren_class = 'table_contents'
74
+
75
+ # Default css class for the nav_brethren_index helper/partial.
76
+ config.nav_brethren_index_class = 'related-topics'
77
+
78
+ # Default css class for the nav_legitimate_children helper/partial.
79
+ config.nav_legitimate_children_class = 'table_contents'
80
+
81
+ # Default css class for the nav_prev_next helper/partial.
82
+ config.nav_prev_next_class = 'navigate_prev_next'
83
+
84
+ # Default "previous" label text for the nav_prev_next helper/partial.
85
+ config.nav_prev_next_label_prev = 'Previous'
86
+
87
+ # Default "next" label text for the nav_prev_next helper/partial.
88
+ config.nav_prev_next_label_next = 'Next'
89
+
90
+ # Default css class for the nav_toc_index helper/partial.
91
+ config.nav_toc_index_class = 'help_map'
92
+
93
+ end
94
+
95
+ ~~~
96
+
97
+ The block above is taken directly from this project’s `config.rb`. The comments
98
+ in the code above describe the purpose of each setting.
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: <code>middleman-pagegroups</code> Documentation
3
+ blurb: Learn how to use <code>middleman-pagegroups</code> to effectively
4
+ manage large and small projects alike.
5
+ layout: template-logo-large
6
+ order: 10
7
+ navigate: true
8
+ ---
9
+
10
+ # <%= current_page.data.title %>
11
+
12
+ <div class="note" markdown="1">
13
+ - All of these documents are part of the `documentation` group. This is because
14
+ the source directory they reside in is named `documentation/`.
15
+
16
+ - This particular page is the index page of the group, and is considered the
17
+ parent of all of the other files.
18
+
19
+ - This page has an `:order` key set; it affects the display order of **its**
20
+ parent; in this case the parent is the welcome page.
21
+
22
+ - This page has the front matter key `:navigate` set to `true`. This means
23
+ that the child pages will include **previous** and **next** navigation
24
+ buttons, unless they have a front matter key `:navigator` set to `false`.
25
+
26
+ - Here is [a page](ovum) that's part of the group and is accessible, but is
27
+ excluded from all of the automatic features.
28
+ </div>
29
+
30
+ * * *
31
+
32
+ <%= nav_legitimate_children :class => 'table_contents' %>