Example:
To mark a page with tags, add:
@def tags = ["tag1", "tag2"]
then that page, along with all others that have the tag tag1
will be listed at /tag/tag1/
.
You can change how a /tag/...
page looks like by modifying the _layout/tag.html
. An important note is that you can only use global page variables (defined in config.md
).
There are three "exceptions":
you can still use {{ispage /tag/tagname/}} ... {{end}}
(or {{isnotpage ...}}
) to have a different layout depending on the tag,
you can use the fd_tag
variable which contains the name of the tag so {{fill fd_tag}}
will input the tag string as is,
you can use {{fill varname path/to/page}}
to exploit a page variable defined in a specific page.
By default the tag list is very simple: it just collects all pages that match the tags and it shows them in a simple list by anti-chronological order (more recent at the top).
You can customise this by defining your own hfun_custom_taglist
function in the utils.jl
file. The commented blueprint for the simple default setting is below and should give you an idea of how to write your own generator.
Assuming you've defined such a function, don't forget to use {{custom_taglist}}
in the _layout/tag.html
instead of the default {{taglist}}
.
function hfun_custom_taglist()::String
tag = locvar(:fd_tag)
rpaths = globvar("fd_tag_pages")[tag]
sorter(p) = begin
pvd = pagevar(p, :date)
if isnothing(pvd)
return Date(Dates.unix2datetime(stat(p * ".md").ctime))
end
return pvd
end
sort!(rpaths, by=sorter, rev=true)
c = IOBuffer()
write(c, "...1...")
for rpath in rpaths
url = get_url(rpath)
title = pagevar(rpath, "title")
if isnothing(title)
title = "/$rpath/"
end
write(c, "...2...")
end
write(c, "...3...")
return String(take!(c))
end
For instance the default uses:
<ul>...</ul>
<li><a href="/$rpath/">$title</a></li>