Page MenuHomePhabricator

Canonical links for File pages of files from a shared repo.
Closed, ResolvedPublic


A few times I caught myself trying an easy way to discover the local wiki a file was (is!) on when it was moved to Commons, by Googling for the filename.

However instead of a result on Commons and one for the local wiki I get dozens of pages filled with all results from each and every wiki that same file-page.

Can a <link caconical> be added on File-pages if the file is from a shared repositary and a local page does not exist (ie. some file pages have Featured Picture-templates on the local page but the file is from Commons - in this case the caconical link should not go to Commons.


Version: 1.17.x
Severity: enhancement



Event Timeline

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

My first reaction to this was I bet <link rel="canonical"... has to be in the same domain, but apparently I am wrong -

Does this also happen when the File-page has a local file page aswell ?

There are many files on Commons that have a mini-page on en.wikipedia with just a {{FeaturedPicture}} template on it.
MediaWiki handles these local filepages without media as a header for the shared image description and is displayed between the .sharedUploadNotice and #shared-image-desc.

This file is on Commons, and description too but it has a local description aswell

I suggest adding another condition to the if statement added in r76867 to see if a local page exists, in that case don't create the canonical link.

I think the check needed for that would be: this->getID() == 0

I have no real preference either way, what do others think ?

<link rel="Canonical"> only works (from my understanding) if the pages are the same, or very close. If a wiki created a local description page, the description might not be close enough for the link tag to work.

But assuming the <link rel="Canonical"> actually works in that case, then we would be stopping content on the local wiki from being indexed, which seems wrong.