| 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/`. |
| 13 |
|
| 14 |
Why not do this instead? |
| 15 |
|
| 16 |
``` |
| 17 |
# doc/v2.0.mdwn |
| 18 |
[[!tag readme]] |
| 19 |
[[!meta title=\"Foobar documentation, version 2.0\"]] |
| 20 |
|
| 21 |
[[!if test=\"doc/* and created_after(.)\" all=\"no\" |
| 22 |
then=\"\"\"[[!template id=\"note\" text=\"[Newer versions are available|doc]\"]]\"\"\"]] |
| 23 |
|
| 24 |
Here is new documentation about Foobar. |
| 25 |
|
| 26 |
# doc/v1.0.mdwn |
| 27 |
[[!tag readme]] |
| 28 |
[[!meta title=\"Foobar documentation, version 1.0\"]] |
| 29 |
|
| 30 |
[[!if test=\"doc/* and created_after(.)\" all=\"no\" |
| 31 |
then=\"\"\"[[!template id=\"note\" text=\"[Newer versions are available|doc]\"]]\"\"\"]] |
| 32 |
|
| 33 |
Here is documentation about Foobar. |
| 34 |
|
| 35 |
# doc.mdwn |
| 36 |
[[!meta title=\"Foobar documentation\"]] |
| 37 |
[[!inline pages=\"doc/*\" limit=\"1\" sort=\"age\" feeds=\"no\" actions=\"no\" raw=\"yes\"]] |
| 38 |
|
| 39 |
Older versions: |
| 40 |
|
| 41 |
[[!inline pages=\"doc/*\" skip=\"1\" archive=\"yes\"]] |
| 42 |
``` |
| 43 |
|
| 44 |
... or even (with a bit of new code) |
| 45 |
|
| 46 |
``` |
| 47 |
# doc.mdwn |
| 48 |
[[!meta redir_first_match=\"doc/*\" sort=\"age\"]] |
| 49 |
``` |
| 50 |
|
| 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. |
| 54 |
|
| 55 |
> this is not my usecase, but it matches exactly |
| 56 |
|
| 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 |
"""]] |