~adnano/kiln-discuss

2

Indexing several directories at once?

Details
Message ID
<9fbbd83a-24f5-446e-94d5-3334ef4aa199@raquin.org>
DKIM signature
missing
Download raw message
Hi, I've made several directories, 3 of them being French-speaking, one 
of them being English-speaking.

I'd like to index all my French-speaking posts into a single, 
chronological (reverse-order) index.

So far my config is the following:

{{ with .site.Root.GetPage (coquelicots/, nocturnes/, lilas/) }}
    {{ range .Pages }}
=> {{ .URL }} {{ .Title }}
    {{ end }}
{{ end }}

I'm not sure I'm getting how to use several arguments right (by following 
https://pkg.go.dev/text/template). Thank you in advance for reading this, 
and for any help.
Details
Message ID
<COWMO3E6X3G9.1U0Z5MBKFCPT4@nitro>
In-Reply-To
<9fbbd83a-24f5-446e-94d5-3334ef4aa199@raquin.org> (view parent)
DKIM signature
missing
Download raw message
On Thu Dec 8, 2022 at 4:37 AM EST, Océane Raquin wrote:
> Hi, I've made several directories, 3 of them being French-speaking, one 
> of them being English-speaking.
>
> I'd like to index all my French-speaking posts into a single, 
> chronological (reverse-order) index.
>
> So far my config is the following:
>
> {{ with .site.Root.GetPage (coquelicots/, nocturnes/, lilas/) }}
>     {{ range .Pages }}
> => {{ .URL }} {{ .Title }}
>     {{ end }}
> {{ end }}
>
> I'm not sure I'm getting how to use several arguments right (by following 
> https://pkg.go.dev/text/template). Thank you in advance for reading this, 
> and for any help.

The GetPage function currently only takes one argument. So you'll need
to duplicate the template (or use a partial template) for each
directory:

	{{ with .site.Root.GetPage "directory1" }}
		{{ partial "pages.gmi" . }}
	{{ end}}
	{{ with .site.Root.GetPage "directory2" }}
		{{ partial "pages.gmi" . }}
	{{ end}}
	{{/* ... */}}

There aren't any functions which can merge groups of pages into a single
list. I might accept a patch to add one, though. You might also consider
putting all your posts in a single directory and using permalinks to
place them in different directories in the output directory. That would
work better with the current design.
Details
Message ID
<COWMOSUTMQX3.1EKGJA85TEZP6@nitro>
In-Reply-To
<COWMO3E6X3G9.1U0Z5MBKFCPT4@nitro> (view parent)
DKIM signature
missing
Download raw message
Correction: you should use site.Root.GetPage instead of
.site.Root.GetPage.
Reply to thread Export thread (mbox)