Jump to content

Topic on Extension talk:Semantic Title/Flow

[RESOLVED] Semantic title won't show

12
Zabien (talkcontribs)

I have a problem with the semantic page title showing, I just can't make it appear. In my template I have tried to add the following:

("Hat Titel" is defined in LocalSettings as title property.)

  • {{#set:Hat Titel={{{Titel}}}}} – to silently add the property. No effect.
  • {{DISPLAYTITLE:[[Hat Titel::{{{Titel|}}}]]}} – as described on this page. No effect.

If I include [[Hat Titel::{{{Titel|}}}]] somewhere in the table/page code, it's showing up! (But I don't want it anywhere on the page...)

On the property pages it's the normal page title showing up instead of the semantic title.

Cindy.cicalese (talkcontribs)

I'm not sure why the first way isn't working, but that is no longer the recommended way to set the display title. The most common problem with that approach is not setting the property to be of type Text. That would silently fail like you are seeing.

But, you should really use DISPLAYTITLE. The problem is that you should be providing text rather than a property to DISPLAYTITLE:

{{DISPLAYTITLE:{{{Titel|}}}}}

Kghbln (talkcontribs)

Try to do {{#set:Hat Titel= }} with the trailing blank within the parser function. I cannot remember exactly but there is some other context that requires it to do it like that.

Zabien (talkcontribs)

Thanks for your offers! I tried all of them. @Kghbln your version wouldn't work with Semantic Forms, I need to tell what form field the title comes from.

In the end, my last version with the property plus the one with #set worked, but DISPLAYTITLE didn't! What caused my issue was a wrongly set data type (it was not set at all), instead of type text. Tried with type page, too, does really only work with data type "text"! Thanks a lot for that hint.

I have included a little note here, as I found the description above not bold enough, feel free to edit, of course.

Cindy.cicalese (talkcontribs)

Thanks for updating the extension page. I had thought that the property type was documented there, but clearly not boldly enough.

I'm guessing that the reason that using DISPLAYTITLE was not working was that you still had $wgSemanticTitleProperties set in your configuration file. That would override DISPLAYTITLE, so you would still be getting the erroneous behavior if the type of the property is not text. If that's not the case and you detected some other bug, please let me know.

Thanks!

Kghbln (talkcontribs)

One the wiki Zabien tested the configuration parameter is indeed still set with "Has pagetitle" for the main namespace.

Zabien (talkcontribs)

@Cindy.cicalese are you saying that I should use either the $wgSemanticTitleProperties or the DISPLAYTITLE? I read from the docu that the former always has to be in there to work. Then I also don't understand the sentence "Being installed and configured, Semantic Title handles page titles and links with no user intervention." (If I don't need any configurations, maybe "usage" should come before "configuration".) But, as I read it, I have two options: Tell in LocalSettings.php or in the template what property should be used. Should work automatically, then, but doesn't, because: Either way, when filling data with a form, I need to tell in the template, what form field corresponds to the property. Sorry, if I'm being picky here, I try to narrow it down. If I use the version you mentioned, {{DISPLAYTITLE:{{{Titel|}}}}}, how will the property ever get stored? @Kghbln sorry, what wiki do you mean??

Cindy.cicalese (talkcontribs)

@Zabien, sorry for the confusion. Yes, you should either use DISPLAYTITLE or set $wgSemanticTitleProperties to set the page title. Doing both is redundant. The latter will override the former.

Since SMW 2.4.1, a property Display title of is automatically set for any page that uses DISPLAYTITLE to set the page title, allowing the display title to be queried. This behavior is present even without the SemanticTitle extension.

This confusion is in part due to the evolution of the SemanticTitle extension. Initially a property needed to be set in order to set the display title of the page, but the extension was updated to use the built in DISPLAYTITLE functionality in MediaWiki core. The ability to set the display title using a semantic property is a legacy of the original approach, left in for backward compatibility. My plan is to create a new DisplayTitle extension that has all of the non-SMW-dependent functionality of SemanticTitle. This will leave only the ability to set the display title from an SMW property or Cargo field in SemanticTitle. I would expect that most people would use only the DisplayTitle extension.

Kghbln (talkcontribs)

@Zabien I meant this. @Cindy So basically SMW core took over the functionality of ST since version 2.4.1 and would no longer be useful for a wiki using SMW meaning that a DisplayTitle extension will be something for Cargo or plain MW?

Kghbln (talkcontribs)

@User:Zabien Oops, I remember that I pulled ST from sandbox some time ago for testing purposes and did not added it back after. So your test yesterday showed only SMW behaviour. I just added version 3.2 again.

Cindy.cicalese (talkcontribs)

@Kghbln, not quite. There are two distinct bits of functionality in SemanticTitle: 1) setting the display title and 2) using the display title in places other than the title of a page (links, etc.). When SemanticTitle was originally written, the support for DISPLAYTITLE in MediaWiki core was not what it is now. Setting the display title from a semantic property duplicates functionality now in core in a less efficient manner and sometimes requires a null edit to update the displayed page title. So, for setting the display title, I now recommend using DISPLAYTITLE rather than indirectly setting it through a semantic property. However, SemanticTitle is still required in order to use the display title as link text for links to a page with a display title. It also provides a parser function to return the display title of a page. This latter functionality is what will move into the new DisplayTitle extension. DisplayTitle will work without Semantic MediaWiki, since it only needs the DISPLAYTITLE functionality in MediaWiki core. The approach taken by SemanticTitle (and in DisplayTitle in the future) for updating the link text only works for text generated by PHP, however. For extensions that use JavaScript to display links to a page, they need to do a bit more work to get the display title for the link text. This is what is now built in to Semantic MediaWiki for JavaScript-based result formats. In addition, a property was added by SMW to reveals the display title for a page. Note that this property is used to query the display title, not (as far as I know) to set the display title.

Kghbln (talkcontribs)

Thanks a lot Cindy for elaborating on the current situation and functionality as well as providing additional background information! I believe this leaves nothing left to say. I am sure that others will appreciate this as I do.

Reply to "[RESOLVED] Semantic title won't show"