aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/Allow_TITLE_to_include_part_of_the_path_in_addition_to_the_basename.mdwn
blob: b97c81efa2c1ea6e0e647b65a0b43e12efa81bc0 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
I need to display part of my pages' path in the `<title>` meta HTML
header instead of their basename ; e.g. for /abs/path/to/basename, I'd
like to set it to path/to/basename.

Of course, one might consider it's my own problem, as I could
workaround this in my templates, and replace, in the `<title>` meta
HTML header, `<TMPL_VAR TITLE>` with a `TMPL_LOOP` on `PARENTLINKS`,
but...

- it's ugly (call it a semantic hijacking if you want) ; a side-effect
  of this ugliness is :
- it defeats any further plugin's (e.g. [[plugins/meta]])
  attempt to override the default title with a nicer one ;
- all parents appear : there is no way to specify how deep to go up in
  the parents tree.

So I really want to avoid this ugly workaround.

Looking at `Render.pm`, the second solution I thought of was :

- add a `parents_in_page_title` configuration option (default=0, i.e.
  the current behaviour) ;
- modify `Render.pm` to insert as much parents as possible (up to
  `N=parents_in_page_title`), separated by '/', in the `title`
  template parameter, before the actual page basename ; I personally
  would use N=2.

The only problems I can see with this approach are :

- it requires modification of the core, which may not be desirable
- the resulting title would be unconditionally overridden by the meta
  plugin, and I can think of no clean solution to make this
  configurable without hacking [[plugins/meta]], which I'd rather not
  to ; I don't care, but once you add a ad-hoc feature to the core,
  you can be sure someone will want a more generic version in less than
  three months ;)

I'm not too convinced writing a plugin for such a small feature isn't
overdoing it, so I'm tempted to implement this solution in the
simplest way : the generated title would be the default and could be
overridden later by plugins.

Joey, what do you think ?

(Before starting to write any single line of code, I need to know how
much you are on the "if you can do it as a plugin, don't ever modify
the core" side... :)

> My general philosophy is that the core should be flexible enough to allow
> plugins to do arbitrary useful stuff. And there are some things in-core
> that I'd like to get out (such as backlinks processing), but that cannot
> currently be moved out efficiently. KISS is also part of my pholisophy.
>
> So no, I don't like adding new options to the core that few users will
> want to use.

In case you're on the hardcore side, I would probably write
a dedicated plugin, called `genealogictitle` or whatever, and :

- use the pagetemplate hook to modify the `title` template parameter,
  and maybe set `title_overridden`, as does the meta plugin
- add a `genealogictitle_depth` configuration option to tell how many
  parents to display
- maybe add a `genealogictitle_overrides_meta` or whatever to decide
  whether a title overridden by [[plugins/meta]] should be overridden
  by genealogictitle ; but anyway, I've not found, in the plugins
  documentation, any hint about the order in which the plugins are
  called for a given hook, so the "choose the strongest between meta
  and genealogictitle" thing might just be more complicated... (no,
  I did not Read The Nice Source, yet).

-- intrigeri

> Plugin sounds reasonable. --[[Joey]]

>> Well, it seems I once more designed a solution before clearly
>> defining my problem... What I really need is more generic, can be
>> done as a plugin, and deserves its own [[todo|pedigree_plugin]], so
>> I'm tagging this one wontfix^W [[done]]. I'm sorry. -- intrigeri