-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.ini
61 lines (54 loc) · 2.49 KB
/
example.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# let's create our first index, called 'year'
[year]
# we want to position it below the `/blog` path, already existing in our Lektor project
parent_path = /blog
# the key used to group blog posts will be the year of the pub_date field in
# our pre-existing blog item model; pub_date needs to be of type `date` or `datetime`
# for this to work
key = "{.year:04d}".format(item.pub_date)
# this is the template file to use to render our index page
template = blog-year-index.html
# and we also want a subindex where we can group our blog posts per month
subindex = month
# these are the fields belonging to our year index
[year.fields]
# first, one called `date` that will be 1st January of the year of this index group
# we will refer to this one again in the subindex below
date = this.children.first().pub_date.replace(month=1, day=1)
# and the year itself as an int, handy to use in our template file
year = this.key|int
# here is our second index; it's a subindex to the index already created above and
# is called 'month'
[year.month]
# this time we will group our blog posts (items) by month; we don't have to worry
# about mixing up the same months from different years, as we have already grouped our
# blog posts per year in this subindex's main index
key = '{.month:02d}'.format(item.pub_date)
# this subindex's pages will be rendered using a different template file
template = blog-month-index.html
# and finally, we also want some fields to be available in our subindex page template
[year.month.fields]
# the date again as the first of the month of this subindex; `this.parent` is the
# year-index page this month-index belongs to
date = this.parent.date.replace(month=this.key|int)
# the year again (as an int, like above)
year = this.parent.year
# and the month as an int
month = this.key|int
###############################################################
# here's another index, called `tags`
[tags]
# this index also groups children from our `/blog` source object
parent_path = /blog
# `key` can be multi-valued, for example if it has the `strings` type assigned
# to it in the Lektor model; in that case items may be listed on multiple # index
# pages
key = item.tags
# yet another template file
template = tag_index.html
# now, we don't want our index pages to be accessible as subpages of /blog, so
# we redefine the slug_format to assign these index pages a path below /tag.
slug_format = "tag/%s"|format(this.key)
[tags.fields]
# and in the template file we want to be able to refer to the tag as `this.tag`
tag = this.key