* The calendar plugin stores state about when it needs to be updated,
[ikiwiki] / doc / plugins / calendar.mdwn
1 [[template id=plugin name=calendar author="[[ManojSrivastava]]"]]
2 [[tag type/chrome]]
3
4 [[calendar ]]
5
6 This plugin displays a calendar, similar to the typical calendars shown on
7 some blogs.
8
9 # examples
10
11         \[[calendar ]]
12
13         \[[calendar type="month" pages="blog/* and !*/Discussion"]]
14
15         \[[calendar type="year" year="2005" pages="blog/* and !*/Discussion"]]
16
17 This plugin is inspired by the calendar plugin for Blosxom, but
18 derives no code from it. This plugin is essentially a fancy front end
19 to archives of previous pages, usually used for blogs. It can produce
20 a calendar for a given month, or a list of months for a given year.
21
22 Since ikiwiki is a wiki compiler, to keep the calendar up-to-date,
23 wikis that include it need to be preiodically refreshes, typically by cron
24 at midnight. Example crontab:
25
26         0 0 * * * ikiwiki -setup ~/ikiwiki.setup -refresh
27
28 The month format calendar simply links to any page posted on each
29 day of the month. The year format calendar links to archive pages, with
30 names like `archives/2007` (for all of 2007)  and `archives/2007/01`
31 (for January, 2007). For this to work, you'll need to create these archive
32 pages. They typically use [[inline]] to display or list pages created in
33 the given time frame.
34
35 ## usage
36
37 * `type` - Used to specify the type of calendar wanted. Can be one of
38   "month" or "year". The default is a month view calendar.
39 * `pages` - Specifies the [[ikiwiki/PageSpec]] of pages to link to from the
40   month calendar. Defaults to "*".
41 * `archivebase` - Configures the base of the archives hierarchy. The
42   default is "archives". Note that this default can also be overridden
43   for the whole wiki by setting `archivebase` in ikiwiki's setup file.
44 * `year` - The year for which the calendar is requested. Defaults to the
45   current year.
46 * `month` - The numeric month for which the calendar is requested, in the
47   range 1..12. Used only for the month view calendar, and defaults to the
48   current month.
49 * `week_start_day` - A number, in the range 0..6, which represents the day
50   of the week that the month calendar starts with. 0 is Sunday, 1 is Monday,
51   and so on. Defaults to 0, which is Sunday.
52 * `months_per_row` - In the annual calendar, number of months to place in
53   each row. Defaults to 3.
54
55 ## CSS
56
57 The output is liberally sprinkled with classes, for fine grained CSS
58 customization.
59
60 * `month-calendar` - The month calendar as a whole.
61 * `month-calendar-head` - The head of the month calendar (ie,"March").
62 * `month-calendar-day-head` - A column head in the month calendar (ie, a
63   day-of-week abbreviation).
64 * `month-calendar-day-noday`, `month-calendar-day-link`, 
65   `month-calendar-day-nolink`, `month-calendar-day-future`,
66   `month-calendar-day-this-day` - The day squares on the month calendar,
67   for days that are not in the month (before or after the month itself), that
68   don't have links, that do have links, that are in the future, or are that
69   are the current day, respectively.
70 * `Sunday`, `Monday`, `Tuesday`, ... - Each day square is also given a class
71   matching its  (localised) day of week, this can be used to highlight
72   weekends.
73 * `year-calendar` - The year calendar as a whole.
74 * `year-calendar-head` - The head of the year calendar (ie, "2007").
75 * `year-calendar-subhead` - For example, "Months".
76 * `year-calendar-month-link`, `year-calendar-month-nolink`,
77   `year-calendar-month-future`, `year-calendar-this-month` - The month
78   squares on the year calendar, for months with stories,
79   without, in the future, and currently selected, respectively.