aboutsummaryrefslogtreecommitdiff
path: root/doc/bugs/listdirectives_doesn__39__t_register_a_link.mdwn
blob: 19a8c99d8fa2b89a390158282ede9059d50b0217 (plain)
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
The [[ikiwiki/directive/listdirectives]]` directive doesn't register a link between the page and the subpages. This is a problem because then the [[ikiwiki/directive/orphans]] directive then marks the directives as orphans... Maybe it is a but with the orphans directive however... A simple workaround is to exclude those files from the orphans call... --[[anarcat]]

> There's a distinction between wikilinks (matched by `link()`,
> `backlink()` etc.) and other constructs that produce a
> hyperlink. Some directives count as a wikilink (like `tag`)
> but many don't (notably `inline`, `map`, `listdirectives`,
> and `orphans` itself). As documented in
> [[ikiwiki/directive/orphans]], orphans will tend to list
> pages that are only matched by inlines/maps, too.
>
> The rule of thumb seems to be that a link to a particular
> page counts as a wikilink, but a directive that lists
> pages matching some pattern does not; so I think
> `listdirectives` is working as intended here.
> `orphans` itself obviously shouldn't count as a wikilink,
> because that would defeat the point of it :-)
>
> Anything that uses a [[ikiwiki/pagespec]] to generate links,
> like `inline` and `map`, can't generate wikilinks, because
> wikilinks are gathered during the scan phase, and pagespecs
> can't be matched until after the scan phase has finished
> (otherwise, it'd be non-deterministic whether all wikilinks
> had been seen yet, and `link()` in pagespecs wouldn't work
> predictably).
>
> I suggest just using something like:
>
>     \[[!orphans pages="* and !blog/* and !ikiwiki/directive/*"]]
>
> This wiki's example of listing [[plugins/orphans]] has a
> more elaborate pagespec, which avoids bugs, todo items etc.
> as well.
>
> --[[smcv]]

> No follow-up or objection for a while, so considering this to
> be [[working as designed|done]]. --[[smcv]]

> > Seems I'm a bit late to butt in, but would it be possible to have two
> > further phases after the scan phase, the first running map and inline 
> > and the second orphan? Then map and inline could log or register their 
> > links (obviously somewhere were it won't change the result of the link function)
> > and orphan could take them into account. This logging could be
> > turned on by parameter to not waste time for users not needing this and 
> > make it tunable (i.e. so that the user can decide which map directives count and which don't)
> > 
> > For someone using map and especially autoindex the output of the orphans directive
> > is simply wrong/useless (at least it is for me). And there is no easy workaround like for listdirectives
> > -- [[holger]]