Jump to content

Topic on Extension talk:Semantic Title

Title property value update takes additional null-edit or page purge to take effect

21
Danwe (talkcontribs)

When editing an article and changing its title property value, then saving, the displayed title does not immediately show up. It only gets updated after another (null-)edit or purging the page.

Is this the expected behavior? Tested with version 3.2 (a05a9ea)

Vedmaka (talkcontribs)

offtopic: what software you use to record such gifs ?

Danwe (talkcontribs)

Software like e.g. “giphy capture“

Cindy.cicalese (talkcontribs)

That you for the video. It clarifies the situation. Yes, this is expected behavior when setting the semantic title using a property. SemanticTitle was almost completely rewritten to use the displaytitle page property in version 3.0. The ability to set the semantic title with a semantic property was kept for legacy reasons but will be phased out in the future. The issue has to do with how page properties get saved. I suggest that you switch to using {{DISPLAYTITLE:New Title}} instead.

Danwe (talkcontribs)

Sorry, I don't quite understand (your last sentence seems incomplete - what should i use instead?). I thought the whole point of this extension was to set the title via a semantic property, or not?

Cindy.cicalese (talkcontribs)

Sorry, I forgot to use "nowiki" in my answer, so the DISPLAYTITLE bit didn't appear. I have fixed it above. Yes, the original intent of this extension was to use a semantic property, but due to changes in MediaWiki core, SemanticTItle was updated to be consistent with features available in MediaWiki core. In this way, the extension does not duplicate functionality and is as efficient as possible.

Vedmaka (talkcontribs)

If we're going to use DISPLAYTITLE, why we need this extension for ?

Cindy.cicalese (talkcontribs)

DISPLAYTITLE only updates the title displayed at the top of a page. Semantic Title also uses this display title value for the link text for links to a page. It optionally adds a subtitle to the page with the original page title. And it also provides a parser function that returns the display title of a page.

Danwe (talkcontribs)

Might be worth thinking about moving this functionality into another extension though as it seems unrelated to the "Semantic" part in the extension name. This would be less confusing. The semantic title extension on top could then be deprecated or fixed.

Cindy.cicalese (talkcontribs)

Yes. My plan for some time has been to create a new extension, DisplayTitle, that has this non-Semantic MediaWiki-dependent functionality. Then, SemanticTitle would retain only the functionality to set the display title from a semantic property. The two extensions would be independent of one another; DisplayTitle could be used alone, but SemanticTitle would typically be more useful when used with DisplayTitle.

Vedmaka (talkcontribs)

General benefit of having semantic property as source for page title is that property itself may come from sources other than page markup.

Cindy.cicalese (talkcontribs)

In such a case, where does the value of the property come from? Is it set in another extension? If so, which one? I would like to understand this use case better.

Vedmaka (talkcontribs)

For example there is Extension:Semantic Extra Special Properties though it is not very obvious that someone would like to use some of these system-like properties as pagename, but possibility of adding semantic properties to pages programmatically exists, so there is a use-case for that.

Cindy.cicalese (talkcontribs)

Do you have a specific need for this functionality - having a semantic property that is set programmatically by an extension used by SemanticTitle as the source of the display title of a page? I do agree that it is a theoretical possibility.

Oetterer (talkcontribs)

My current (widespread) usecase: As you might know, I generally use scribunto in conjunction with SMW (and Cargo).

So If I understand SemanticTitle and DisplayTitle correctly:

  • I store a semantic property (e.g. named "has display title"
  • SemanticTitle would then use the contents of this property and set a display title (assumming the namespace is configured correctly)
  • Extension:DisplayTitle would then use this set display title in link texts

Now my "problem": My interface to SMW is SSC (SemanticScribunto Extension) which allows for easy and efficient storing of semantic data. Using {{DISPLAYTITLE:xxx}} in my modules would require a comparably "expensive" parser function call via frame. So for me the better way would be, if my module would store semantic data (and therefore the page title), and semantic title would serve as the middleman to DisplayTitle. The alternative could be a lua function in core or DisplayTitle to set the display title of a page inside a module.

Interested to hear your thoughts @Cindy.cicalese?

Cindy.cicalese (talkcontribs)

Interesting. I like the idea of defining a Lua function that directly sets the displaytitle and could be used from within other Lua functions. The PHP supporting that function would need to call CoreParserFunctions::displaytitle() from a context that has access to a parser. No semantic properties would be required, which would be a good thing, since as described earlier in this thread, the mechanics of setting the display title page property from a semantic property is convoluted and does not work perfectly, often requiring a null edit. It seems unnecessarily complicated to introduce a semantic property if the page property can be set directly from a Lua function. I'm not sure when I'd have a chance to work on this, but feel free to submit a patch to DisplayTitle to do this.

Oetterer (talkcontribs)

Done. :) Needs review and merge.

Cindy.cicalese (talkcontribs)

Awesome! Thank you!! It looks great! Does it satisfy your use case and work as we hoped? I will try to test it on our infrastructure today. I'm assuming that the extension still works OK without Scribunto installed (obviously without the extended functionality), right?

Oetterer (talkcontribs)

I tested it on 1.27.1 and it does what it is supposed to do. For my use case it means, augmenting the modules for all the entities that need a display title. Until this is finished, I will keep using SemanticTitle. After that, it should be obsolete for me.

Cindy.cicalese (talkcontribs)

Thank you! I also tested, and it works great! I merged the patch and updated the documentation at Extension:DisplayTitle.

Oetterer (talkcontribs)

Great! Thanks! <3

Reply to "Title property value update takes additional null-edit or page purge to take effect"