Page MenuHomePhabricator

In some situations an additional NULL Edit is neccessary for {{DISPLAYTITLE}} to work properly
Closed, DeclinedPublic

Description

Hello Cindy,

Since switching to the DISPLAYTITLE delcaration of Semantic Titles, I've noticed the following problem:

If the displaytitle is is built using queries on the current pages properties, it must be saved twice.

One example:

{{DISPLAYTITLE:{{{Organization Name|}}} {{{Legal Form|}}}, {{#show: {{FULLPAGENAME}}|?Country|link=none|sep=;}} }}

The Organization Name and Legal Form can be set on first page save, but the query on the current page can't return anything as the page doesn't exist at that time. An additonal "null edit" (https://en.wikipedia.org/wiki/Wikipedia:Purge#Null_edit) is sufficient.

This problem is probably not only relevant to SemanticTitle, as there are other parser functions that may have the same issues with not-yet existing pages.

Best,
Simon

Event Timeline

Yes, that makes sense, since the page does not exist to query yet. This isn't really a bug in SemanticTitle (which isn't involved at all in this process) or the DISPLAYTITLE magic word (which is responsible for saving the displaytitle page property). The same would be true if you were trying to set any persistent data or property from the results of a query on a page that had not yet been saved.

I'm assuming that you do not have a {{{Country|}} parameter to pass in to DISPLAYTITLE, otherwise you would do so. I have handled similar issues with the Variables extension. I set the value of a variable and then use that both to set the property and to pass into DISPLAYTITLE. Would that work in your situation?

Thats a good idea, but unfortunately it doesn't work (probably because the template is loaded after the template I need).

Currently I'm thinking about a small extension where you can define which semantic properties need an additional null edit in order to be set properly. If the existence of such a semantic property is detected, a null edit is executed automatically.

What do you think?

Interesting idea. I still don't completely understand why the value used for the Country property isn't available until after the page has been saved, but it sounds like there is some complexity there. My only concern for the extension would be figuring out how to make it so that the null edit would not trigger another null edit and so on. Perhaps there is some code in SemanticDependency that would be helpful to you, although it is triggering a property update on another page, not the page being saved.

If this is still an issue for you, please let me know.