Page MenuHomePhabricator

Implement a way to set the document title properly
Closed, DeclinedPublic

Description

Suggesting the page.startup module gets a method like OutputPage's setPageTitle and setPageTitleActionText.

The code to do it properly is fairly tedious, centralizing will make sure it's done right and without hassle.

It should use the message key 'pagetitle' (making sure to globally replace {{SITENAME}} with wgSiteName and pass the input as first message param).

If a prefixed action text is used, separation should be done with ' - '.


Version: unspecified
Severity: enhancement

Details

Reference
bz31258

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 11:49 PM
bzimport set Reference to bz31258.
bzimport added a subscriber: Unknown Object (MLST).

What sort of circumstances involve changing the page title in JS currently or envisioned?

I pointed someone to this bug without thoroughly reviewing the necessary tasks, I think it's safe to say it's not actually easy because it involves building a totally new JS library that mimicks existing PHP behaviour.

If we'd like to re-add the easy tag after the idea is more fleshed out, that should be OK.

(In reply to comment #2)

I think it's safe to say it's not actually easy because it involves
building a totally new JS library that mimicks existing PHP behaviour.

Uh.. what library?

This is just a new method on mw.page that would:

  • Set document.title to mw.msg 'pagetitle' (supporting SITENAME and $1)
  • Updating firstHeading (usually <h1) text

Anything else?

(In reply to comment #1)

What sort of circumstances involve changing the page title in JS currently or
envisioned?

Nothing yet in core, but I noticed some scripts and gadgets re-inventing this over and over and since it is core that knows/decides where and how the title is handled, it is best maintained in core.

But I agree, we don't need this on the short term. Not sure if would even be merged if patches/proposed right now.

Nevermind. I was doing something hacky that I shouldn't have been doing.