UNPKG

2.15 kBMarkdownView Raw
1# apostrophe-blog-2: a better blog for Apostrophe
2
3This new implementation is based on the idea that blog posts have more in common with pages than with snippets. It simplifies permissions and makes the whole experience more contextual.
4
5Each blog post is a child of its parent blog. This allows permissions to work just like page permissions in Apostrophe. However, the pagination of posts works as you would expect it to in a post, and the posts don't clutter up the "reorganize" modal.
6
7A blog can still choose to display content from other blogs on the site. This is easy to do via the page settings of the blog (see the "and these blogs" field).
8
9There is also a widget available for displaying blog posts anywhere on the site.
10
11## Configuration Options
12
13Blog posts cannot have subpages. And, by default, index pages can't have subpages other than blog posts. But you can enable the latter by setting the `allowSubpagesOfIndex` option to `true` when configuring the module. It's not forbidden, it's just confusing for users who don't need it.
14
15## Subclassing
16
17For now, subclassing of blog-2 is fairly simple, though it requires some configuration in your app.js file. Here's a sample of what you'll need to successfully subclass and create your own distinct instance of a blog-like thing:
18
19```JavaScript
20'handbook': {
21 extend: 'apostrophe-blog-2',
22 name: 'handbooks',
23 pieceName: 'policy',
24 pieceLabel: 'Policy',
25 indexName: 'handbook',
26 indexLabel: 'Handbook',
27 pieces: {
28 pluralLabel: 'Policies',
29 }
30 }
31```
32
33## Limiting Choices in the Widget
34
35Sometimes you won't want the editor to have their pick of title, tag and particular blogs as sources for a particular widget. For instance, you might want to restrict to title only for simplicity.
36
37You can do that with the `sources` option when inserting the widget:
38
39```markup
40{{ aposSingleton(page, 'articles', 'blog', { sources: [ 'title' ] }) }}
41```
42
43The `sources` option may contain `title`, `tag` and/or `page` in any order. The first option given becomes the default choice.
44
45If you limit the editor to only one source, the dropdown menu is automatically hidden.