]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - doc/forum/Questions_about_a_new_plugin/comment_1_52f30b2d89d9223fd367603534d06435._comment
no time to do maser for now, but some pointers and thanks
[git.ikiwiki.info.git] / doc / forum / Questions_about_a_new_plugin / comment_1_52f30b2d89d9223fd367603534d06435._comment
1 [[!comment format=mdwn
2  username="smcv"
3  subject="I'm not so sure that copying metadata is desirable"
4  date="2016-06-09T15:09:30Z"
5  content="""
6 I'm not so sure that copying metadata around is the right solution to the
7 use case that you outlined. If you do that, then `/doc/v2.0/` and `/doc/` will
8 be indistinguishable anywhere that pages are listed by their metadata - it's as
9 though you'd copied the text content of `doc/v2.0.mdwn` into `doc.mdwn`. For
10 example, if it's tagged `readme`, then a list of pages matching `tagged(readme)`
11 will have two apparently identical entries, one of which is `/doc/` and the other
12 is `/doc/v2.0/`.
14 Why not do this instead?
16 ```
17 # doc/v2.0.mdwn
18 [[!tag readme]]
19 [[!meta title=\"Foobar documentation, version 2.0\"]]
21 [[!if test=\"doc/* and created_after(.)\" all=\"no\"
22   then=\"\"\"[[!template id=\"note\" text=\"[Newer versions are available|doc]\"]]\"\"\"]]
24 Here is new documentation about Foobar.
26 # doc/v1.0.mdwn
27 [[!tag readme]]
28 [[!meta title=\"Foobar documentation, version 1.0\"]]
30 [[!if test=\"doc/* and created_after(.)\" all=\"no\"
31   then=\"\"\"[[!template id=\"note\" text=\"[Newer versions are available|doc]\"]]\"\"\"]]
33 Here is documentation about Foobar.
35 # doc.mdwn
36 [[!meta title=\"Foobar documentation\"]]
37 [[!inline pages=\"doc/*\" limit=\"1\" sort=\"age\" feeds=\"no\" actions=\"no\" raw=\"yes\"]]
39 Older versions:
41 [[!inline pages=\"doc/*\" skip=\"1\" archive=\"yes\"]]
42 ```
44 ... or even (with a bit of new code)
46 ```
47 # doc.mdwn
48 [[!meta redir_first_match=\"doc/*\" sort=\"age\"]]
49 ```
51 In real life you'd probably want to use a special `[[!template]]` for the link
52 to the latest version, so that it's easier to make them all consistent, but
53 for those examples I'm just using the standard [[templates/note]] and some markup.
55 > this is not my usecase, but it matches exactly
57 Why not ask us about your real use-case, in case it turns out that it *doesn't*
58 match exactly after putting more thought into it? :-)
59 """]]