]> sipb.mit.edu Git - ikiwiki.git/blob - doc/plugins/aggregate.mdwn
21a8105d06308958c68a02719965198d11796aa2
[ikiwiki.git] / doc / plugins / aggregate.mdwn
1 [[template id=plugin name=aggregate author="[[Joey]]"]]
2 [[tag type/useful]]
3
4 This plugin allows content from other feeds to be aggregated into the wiki.
5 Aggregate a feed as follows:
6
7         \[[aggregate name="example blog" dir="example"
8         feedurl="http://example.com/index.rss"
9         url="http://example.com/" updateinterval="15"]]
10
11 That example aggregates posts from the specified RSS feed, updating no
12 more frequently than once every 15 minutes, and puts a page per post under
13 the example/ directory in the wiki.
14
15 You can then use ikiwiki's [[ikiwiki/blog]] support to create a blog of one or
16 more aggregated feeds. For example:
17
18         \[[inline pages="internal(example/*)"]]
19
20 ## setup
21
22 Make sure that you have the [[html]] plugin enabled, as the created pages are
23 in html format. The [[meta]] and [[tag]] plugins are also recommended. The
24 [[htmltidy]] plugin is suggested, since feeds can easily contain html
25 problems, some of which tidy can fix.
26
27 You will need to run ikiwiki periodically from a cron job, passing it the
28 --aggregate parameter, to make it check for new posts. Here's an example
29 crontab entry:
30
31         */15 * * * * ikiwiki --setup my.wiki --aggregate --refresh
32
33 Alternatively, you can allow `ikiwiki.cgi` to trigger the aggregation. You
34 should only need this if for some reason you cannot use cron, and instead
35 want to use a service such as [WebCron](http://webcron.org). To enable
36 this, turn on `aggregate_webtrigger` in your setup file. The url to
37 visit is `http://whatever/ikiwiki.cgi?do=aggregate_webtrigger`. Anyone
38 can visit the url to trigger an aggregation run, but it will only check
39 each feed if its `updateinterval` has passed.
40
41 ## usage
42
43 Here are descriptions of all the supported parameters to the `aggregate`
44 directive:
45
46 * `name` - A name for the feed. Each feed must have a unique name.
47   Required.
48 * `url` - The url to the web page for the feed that's being aggregated.
49   Required.
50 * `dir` - The directory in the wiki where pages should be saved. Optional,
51   if not specified, the directory is based on the name of the feed.
52 * `feedurl` - The url to the feed. Optional, if it's not specified ikiwiki
53   will look for feeds on the `url`. RSS and atom feeds are supported.
54 * `updateinterval` - How often to check for new posts, in minutes. Default
55   is 15 minutes.
56 * `expireage` - Expire old items from this feed if they are older than
57   a specified number of days. Default is to never expire on age.
58 * `expirecount` - Expire old items from this feed if there are more than
59   the specified number total. Oldest items will be expired first. Default
60   is to never expire on count.
61 * `tag` - A tag to tag each post from the feed with. A good tag to use is
62   the name of the feed. Can be repeated multiple times. The [[tag]] plugin
63   must be enabled for this to work.
64 * `template` - Template to use for creating the aggregated pages. Defaults to
65   aggregatepost.
66
67 Note that even if you are using subversion or another revision control
68 system, pages created by aggregation will *not* be checked into revision
69 control.
70
71 ## internal pages
72
73 This plugin creates a page for each aggregated item. 
74
75 Currently, by default, these pages have the ".html" extension, and are
76 first-class wiki pages -- which allows them to be inlined into blogs
77 and even edited.
78
79 That turns out to not be ideal for aggregated content, because publishing
80 files for each of those pages is a waste of disk space and CPU, and you probably
81 don't want to allow them to be edited. So, there is an alternate method
82 that can be used, turned on by the `aggregateinternal` option in the setup
83 file.
84
85 If `aggregateinternal` is enabled, aggregated pages are stored in the source
86 directory with a "._aggregate" extension. These pages cannot be edited by
87 web users, and do not generate first-class wiki pages. They can only be
88 inlined into a blog.
89
90 If you are already using aggregate and want to enable `aggregateinternal`,
91 you should follow this process:
92
93 1. Update all [[PageSpecs|ikiwiki/PageSpec]] that refer to the aggregated
94    pages -- such as those in inlines. Put "internal()" around globs 
95    in those PageSpecs. For example, if the PageSpec was "foo/*", it should
96    be changed to "internal(foo/*)". This has to be done because internal
97    pages are not matched by regular globs.
98 2. Use [[ikiwiki-transition]] to move all existing aggregated `.html`
99    files. The command to run is `ikiwiki-transition aggregateinternal $srcdir`
100 3. Turn on `aggregateinternal` in the setup file and rebuild the wiki.