aboutsummaryrefslogtreecommitdiffstats
path: root/docs/path_handlers.rst
blob: d771ae1f29ba8d410d12a4afed7a469d39649b24 (plain) (blame)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
.. title: Path Handlers for Nikola
.. slug: path-handlers
.. author: The Nikola Team

.. DO NOT EDIT, this file is auto-generated by scripts/document_path_handlers.py

Nikola supports special links with the syntax ``link://kind/name``. In
templates you can also use ``_link(kind, name)``.  You can add query strings
(``?key=value``) for extra arguments, or pass keyword arguments to ``_link`` in
templates (support and behavior depends on path handlers themselves). Fragments
(``#anchor``) will be appended to the transformed link.

Here are the descriptions for all the supported kinds.

.. class:: dl-horizontal

archive
    Link to archive path, name is the year.
    
    Example:
    
    link://archive/2013 => /archives/2013/index.html

author
    Link to an author's page.
    
    Example:
    
    link://author/joe => /authors/joe.html

author_atom
    Link to an author's Atom feed.
    
    Example:
    
    link://author_atom/joe => /authors/joe.atom

author_index
    Link to the authors index.
    
    Example:
    
    link://authors/ => /authors/index.html

author_rss
    Link to an author's RSS feed.
    
    Example:
    
    link://author_rss/joe => /authors/joe.xml

category
    A link to a category. Takes page number as optional keyword argument.
    
    Example:
    
    link://category/dogs => /categories/dogs.html

category_atom
    A link to a category's Atom feed.
    
    Example:
    
    link://category_atom/dogs => /categories/dogs.atom

category_index
    A link to the category index.
    
    Example:
    
    link://category_index => /categories/index.html

category_rss
    A link to a category's RSS feed.
    
    Example:
    
    link://category_rss/dogs => /categories/dogs.xml

filename
    Link to post or page by source filename.
    
    Example:
    
    link://filename/manual.txt => /docs/handbook.html
    

gallery
    Link to an image gallery's path.
    
    It will try to find a gallery with that name if it's not ambiguous
    or with that path. For example:
    
    link://gallery/london => /galleries/trips/london/index.html
    
    link://gallery/trips/london => /galleries/trips/london/index.html
    

gallery_global
    Link to the global gallery path, which contains all the images in galleries.
    
    There is only one copy of an image on multilingual blogs, in the site root.
    
    link://gallery_global/london => /galleries/trips/london/index.html
    
    link://gallery_global/trips/london => /galleries/trips/london/index.html
    
    (a ``gallery`` link could lead to eg. /en/galleries/trips/london/index.html)
    

gallery_rss
    Link to an image gallery's RSS feed.
    
    It will try to find a gallery with that name if it's not ambiguous
    or with that path. For example:
    
    link://gallery_rss/london => /galleries/trips/london/rss.xml
    
    link://gallery_rss/trips/london => /galleries/trips/london/rss.xml
    

index
    Link to a numbered index.
    
    Example:
    
    link://index/3 => /index-3.html

index_atom
    Link to a numbered Atom index.
    
    Example:
    
    link://index_atom/3 => /index-3.atom

index_rss
    A link to the RSS feed path.
    
    Example:
    
    link://rss => /blog/rss.xml

listing
    Return a link to a listing.
    
    It will try to use the file name if it's not ambiguous, or the file path.
    
    Example:
    
    link://listing/hello.py => /listings/tutorial/hello.py.html
    
    link://listing/tutorial/hello.py => /listings/tutorial/hello.py.html
    

listing_source
    Return a link to the source code for a listing.
    
    It will try to use the file name if it's not ambiguous, or the file path.
    
    Example:
    
    link://listing_source/hello.py => /listings/tutorial/hello.py
    
    link://listing_source/tutorial/hello.py => /listings/tutorial/hello.py
    

post_path
    Link to the destination of an element in the POSTS/PAGES settings.
    
    Example:
    
    link://post_path/posts => /blog
    

root
    Link to the current language's root.
    
    Example:
    
    link://root_path => /
    
    link://root_path => /translations/spanish/
    

rss
    A link to the RSS feed path.
    
    Example:
    
    link://rss => /blog/rss.xml

slug
    Return a link to a post with given slug, if not ambiguous.
    
    Example:
    
    link://slug/yellow-camaro => /posts/cars/awful/yellow-camaro/index.html
    

tag
    A link to a tag's page. Takes page number as optional keyword argument.
    
    Example:
    
    link://tag/cats => /tags/cats.html

tag_atom
    A link to a tag's Atom feed.
    
    Example:
    
    link://tag_atom/cats => /tags/cats.atom

tag_index
    A link to the tag index.
    
    Example:
    
    link://tag_index => /tags/index.html

tag_rss
    A link to a tag's RSS feed.
    
    Example:
    
    link://tag_rss/cats => /tags/cats.xml