aboutsummaryrefslogtreecommitdiff
path: root/doc/forum/Questions_about_a_new_plugin/comment_1_52f30b2d89d9223fd367603534d06435._comment
blob: 0a9d86166616f824b3756b9b7d0172a7672263e5 (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
52
53
54
55
56
57
58
59
[[!comment format=mdwn
 username="smcv"
 subject="I'm not so sure that copying metadata is desirable"
 date="2016-06-09T15:09:30Z"
 content="""
I'm not so sure that copying metadata around is the right solution to the
use case that you outlined. If you do that, then `/doc/v2.0/` and `/doc/` will
be indistinguishable anywhere that pages are listed by their metadata - it's as
though you'd copied the text content of `doc/v2.0.mdwn` into `doc.mdwn`. For
example, if it's tagged `readme`, then a list of pages matching `tagged(readme)`
will have two apparently identical entries, one of which is `/doc/` and the other
is `/doc/v2.0/`.

Why not do this instead?

```
# doc/v2.0.mdwn
[[!tag readme]]
[[!meta title=\"Foobar documentation, version 2.0\"]]

[[!if test=\"doc/* and created_after(.)\" all=\"no\"
  then=\"\"\"[[!template id=\"note\" text=\"[Newer versions are available|doc]\"]]\"\"\"]]

Here is new documentation about Foobar.

# doc/v1.0.mdwn
[[!tag readme]]
[[!meta title=\"Foobar documentation, version 1.0\"]]

[[!if test=\"doc/* and created_after(.)\" all=\"no\"
  then=\"\"\"[[!template id=\"note\" text=\"[Newer versions are available|doc]\"]]\"\"\"]]

Here is documentation about Foobar.

# doc.mdwn
[[!meta title=\"Foobar documentation\"]]
[[!inline pages=\"doc/*\" limit=\"1\" sort=\"age\" feeds=\"no\" actions=\"no\" raw=\"yes\"]]

Older versions:

[[!inline pages=\"doc/*\" skip=\"1\" archive=\"yes\"]]
```

... or even (with a bit of new code)

```
# doc.mdwn
[[!meta redir_first_match=\"doc/*\" sort=\"age\"]]
```

In real life you'd probably want to use a special `[[!template]]` for the link
to the latest version, so that it's easier to make them all consistent, but
for those examples I'm just using the standard [[templates/note]] and some markup.

> this is not my usecase, but it matches exactly

Why not ask us about your real use-case, in case it turns out that it *doesn't*
match exactly after putting more thought into it? :-)
"""]]