1 [[!template id=plugin name=aggregate author="[[Joey]]"]]
4 This plugin allows content from other feeds to be aggregated into the wiki.
5 Aggregate a feed as follows:
7 \[[!aggregate name="example blog" dir="example"
8 feedurl="http://example.com/index.rss"
9 url="http://example.com/" updateinterval="15"]]
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.
15 You can then use ikiwiki's [[ikiwiki/blog]] support to create a blog of one or
16 more aggregated feeds. For example:
18 \[[!inline pages="internal(example/*)"]]
22 New users of aggregate should enable the `aggregateinternal => 1` option in the
23 .setup file. If you don't do so, you will need to enable the [[html]] plugin
24 as well as aggregate itself, since feed entries will be stored as HTML.
26 The [[meta]] and [[tag]] plugins are also recommended. The
27 [[htmltidy]] plugin is suggested, since feeds can easily contain html
28 problems, some of which tidy can fix.
30 You will need to run ikiwiki periodically from a cron job, passing it the
31 --aggregate parameter, to make it check for new posts. Here's an example
34 */15 * * * * ikiwiki --setup my.wiki --aggregate --refresh
36 Alternatively, you can allow `ikiwiki.cgi` to trigger the aggregation. You
37 should only need this if for some reason you cannot use cron, and instead
38 want to use a service such as [WebCron](http://webcron.org). To enable
39 this, turn on `aggregate_webtrigger` in your setup file. The url to
40 visit is `http://whatever/ikiwiki.cgi?do=aggregate_webtrigger`. Anyone
41 can visit the url to trigger an aggregation run, but it will only check
42 each feed if its `updateinterval` has passed.
46 Here are descriptions of all the supported parameters to the `aggregate`
49 * `name` - A name for the feed. Each feed must have a unique name.
51 * `url` - The url to the web page for the feed that's being aggregated.
53 * `dir` - The directory in the wiki where pages should be saved. Optional,
54 if not specified, the directory is based on the name of the feed.
55 * `feedurl` - The url to the feed. Optional, if it's not specified ikiwiki
56 will look for feeds on the `url`. RSS and atom feeds are supported.
57 * `updateinterval` - How often to check for new posts, in minutes. Default
59 * `expireage` - Expire old items from this feed if they are older than
60 a specified number of days. Default is to never expire on age.
61 * `expirecount` - Expire old items from this feed if there are more than
62 the specified number total. Oldest items will be expired first. Default
63 is to never expire on count.
64 * `tag` - A tag to tag each post from the feed with. A good tag to use is
65 the name of the feed. Can be repeated multiple times. The [[tag]] plugin
66 must be enabled for this to work.
67 * `template` - Template to use for creating the aggregated pages. Defaults to
70 Note that even if you are using subversion or another revision control
71 system, pages created by aggregation will *not* be checked into revision
74 ## internal pages and `aggregateinternal`
76 This plugin creates a page for each aggregated item.
78 If the `aggregateinternal` option is enabled in the setup file (which is
79 recommended), aggregated pages are stored in the source directory with a
80 "._aggregated" extension. These pages cannot be edited by web users, and
81 do not generate first-class wiki pages. They can still be inlined into a
82 blog, but you have to use `internal` in [[PageSpecs|IkiWiki/PageSpec]],
83 like `internal(blog/*)`.
85 For backward compatibility, the default is that these pages have the
86 ".html" extension, and are first-class wiki pages -- each one generates
87 a separate HTML page in the output, and they can even be edited.
89 That turns out to not be ideal for aggregated content, because publishing
90 files for each of those pages is a waste of disk space and CPU, and you
91 probably don't want to allow them to be edited. So, there is an alternative
92 method that can be used (and is recommended), turned on by the
93 `aggregateinternal` option in the setup file.
95 If you are already using aggregate and want to enable `aggregateinternal`,
96 you should follow this process:
98 1. Update all [[PageSpecs|ikiwiki/PageSpec]] that refer to the aggregated
99 pages -- such as those in inlines. Put "internal()" around globs
100 in those PageSpecs. For example, if the PageSpec was `foo/*`, it should
101 be changed to `internal(foo/*)`. This has to be done because internal
102 pages are not matched by regular globs.
103 2. Use [[ikiwiki-transition]] to move all existing aggregated `.html`
104 files. The command to run is `ikiwiki-transition aggregateinternal $srcdir`,
105 or if you have changed the `htmlext` option to something other than "html",
106 `ikiwiki-transition aggregateinternal $srcdir $htmlext`
107 3. Turn on `aggregateinternal` in the setup file and rebuild the wiki.