Jump to content

Topic on Extension talk:Semantic Title

Linking using display title

6
Zabien (talkcontribs)

It's probably really easy, but I cannot get my head around this: Let's say:

  1. I am trying to use Page Title/Displaytitle/Semantic Title to use an ID as non-changing URL (HERO001516, HERO001517, HERO001518, …) and the display title comes from a text field (e.g. via input in page forms).
  2. Now, the user puts in "Batman" and HERO001516 is created. I want to be able to link in the wiki with [[Batman]] to HERO001516. This doesn't work out of (my) box, Batman is a red link.
  3. A redirect would be an option, but then the user changes Batman to "Spiderman" and I would have to also rename the redirect page, which leads the functionality for me ad absurdum.
  4. I have learnt I can display the page title in page forms (instead of the ID) via setting $wgPageFormsUseDisplayTitle = true;, wonderful.

But how can I link to pages via their set page title? And do I need Extension:Display Title for this, or is this, what it is doing, would Semantic Title improve the linking functionality or is {DISPLAYTITLE:…}} even enough and I have just missed a point? Happy for any hints.

Cindy.cicalese (talkcontribs)

> I want to be able to link in the wiki with [[Batman]] to HERO001516.

Linking to wiki pages requires the page title (HERO001516), not the display title (Batman). The page title is the non-changing ID used both in URLs and in links. If you linked using the display title, you would have the same problem that you mention in 3 - renaming would require adjusting all of your links. Also, since page titles are unique but display titles may not be unique, it may be impossible to resolve the link using a display title to a particular page.

What Extension:Display Title gives you is that the link text displayed by [[HERO001516]] would be displayed as Batman.

Kghbln (talkcontribs)

Indeed this is out of scope of this extension. However I see the "issue" or better feature request for creating a separate extension that takes the subject label and creates a redirect from a page called like this to the subject page. I have looked around a bit for an extension that does just this about one and a half years ago but have not found any. It appears that there is still not extension around for this. When it comes to the a changed subject label this hypothetical extension would just create a second redirect.

Zabien (talkcontribs)

Thank you both for your explanations! Good to know it doesn't make sense to look further. – I was even thinking I might lead MediaWiki's core function of unique URLs/page titles ad absurdum by trying to give a dynamic value that characteristic… I will have to reconsider the idea of an ID here and make use of redirects. I could have lived with redirecting display titles, though. And in Page Forms, there is a function for "unique in category", which could resolve the question for uniqueness (although it sounds a bit like trouble after manual changes…).

Cindy.cicalese (talkcontribs)

@Kghbln yes, something like that would be interesting. I have often wondered about this particular limitation of the display title approach. When using PageForms, the mapping between display title and page title is handled for you. But, for a user typing in wikitext wanting to link to a page, the need to use the obscure page title is troublesome. I have to admit that I have never liked redirects for some reason, but they may help here. But, I'd rather have a page keep a list of aliases (maybe using the new MCR capability?) that it could be linked from. When a page is rendered, when the link renderer encounters [[x]] it would look for a page with the title x. If none is found, it would look for pages with an alias (a current or previous value of display title) of x. If one is found, the link would be rendered to that page. If more than one is found, a link would be created to a dynamically generated disambiguation page. If none is found, there would be a red link. The caching behavior of this approach would have to be considered.

Kghbln (talkcontribs)

The advantage of creating a redirect page is that you get an subject showing up in the title key search and that people are probably triggered to edit the redirect target page rather than the redirect if unsure where to place the content best.

However having a page keep a list of its aliases is probably nice to have and MCR looks like it could be supporting a solution here. Your brainstorm sounds good to me. I am not sure if the title key search would work here but this is probably a matter of implementation. One other thing still to consider is what to do with redirects to sections of a subject which is very often done too.

Reply to "Linking using display title"