Changing page title as it appears in MediaWiki category - mediawiki

I've been trying to use DEFAULTSORT to sort pages based on a template parameter instead of the page title. This is how it appears at the top of the template:
{{DEFAULTSORT:{{{Username}}}}}
This is how it appears after the argument is transcluded:
{{DEFAULTSORT:d3xus}}
It would be nice for it to appear in categories as d3xus and not D3xus. There's no change in how the page is sorted because they both begin with the same symbol. Using an extension or magic word, is it possible to change how a page appears when viewed in a category? DEFAULTSORT only changes how the page is sorted with respect to other pages in the same category, but it does not change the page title in the category.

That's actually impossible without a bigger change in the code. There is a task for it in Wikimedia's bug/feature tracking software Phabricator: T19212, but it's actually stalled :(

There is no such thing. If you want to change the page title regardless where it is displayed, you can use $wgCapitalLinks or {{DISPLAYTITLE}}.
Actually it seems there is such a thing: Extension:Semantic Title. It is very hacky though (and you need to install Semantic MediaWiki).

Try this:
Method 1: Add to your MediaWiki site: {{DISPLAYTITLE:d3xus}} and [[Category:d3xus]].
Method 2: https://www.mediawiki.org/wiki/Extension:Semantic_Title

Related

How can I display spaces in Media Wiki Page Title but not in the URL?

How can I display spaces in Media Wiki Page Title but not in the URL?
Desired Result: if someone types in example.com/w/John1:1-5 then I'd like the page title on that page to show John 1:1-5.
I realize I could create a page at example.com/w/John_1:1-5, but I don't want users to have to type the underscore.
Is there a way to do this without creating a redirect?
Thanks!
You can use the DISPLAYTITLE magic word for this, e.g. {{DISPLAYTITLE:John 1:1-5}}.
$wgAllowDisplayTitle must be set to true order to use it, and $wgRestrictDisplayTitle set to false. The former enables the feature, and the latter permits more than just letter-case changes (i.e. the display title can be anything at all, even quite different from the page title).
If you want to display inbound links on other pages (i.e. you type [[John1:1-5]] but want it to display as John 1:1-5) then the Display Title extension can do that.

How do I transclude part of page while maintaining pagename variable?

I currently have a template that includes the magic variable PAGENAME and FULLPAGENAME which is then applied to a large number of pages with more detailed information on each item. I would like to transclude a part of those pages to another single summary page while maintaining PAGENAME of the parent page.
I have tried to use subst:FULLPAGENAME, however all that does is display "template:*Thepage*" on all instances where the template is called.
I have also tried to use the includeonly tag, but it doesn't seem to want to work very well.
I'm relatively new to mediawiki, any help would be appreciated.
You don't. You can have a transclusion change of arbitrary length; the software has no way of figuring out which link in that chain you need the pagename for.

Headings created inside of a template

I have a number of templates that create headings based on a formula. I am wondering if there is anyway to create an "edit" link that will take you directly to that section? The way that it currently works, the edit link takes you to editing the template itself. Could I possibly create a customized link that would keep you on the page and take you to right part?
Here is some sample code to help clear things up...
Template:Head:
==={{{1}}}===
This is a heading titled "{{{1}}}"
Test Page:
=Section 1=
{{head|1.1}}
{{head|1.2}}
{{head|1.3}}
=Section 2=
{{head|2.1}}
{{head|2.2}}
{{head|2.3}}
At the moment, if I want to edit the information for template "2.3", I have to edit all of section 2. (Note that for this example, that isn't a big deal. For the actual templates I am working with on my site, the templates have dozens of parameters and there are sometimes 10 or more in a section.)
Bottom line, is there way to create a custom edit link inside of the {{head}} template that would take you directly to editing the templates call on the page "Test Page"? Hope that makes sense.
Edit: Is there perhaps a way to make use of "anchor" tags? Can anchors be passed in to the URL?
To restate your problem, when you transclude a section heading the header isn't treated as being part of the destination page, so the edit link takes you back to the source. So you need a separate container for the template in order to edit it individually, and a complete section is the smallest editable container.
The only way I can think of doing this is using subpages (or virtual subpages if you don't have that ennabled in this namespace, doesn't change anything). So instead of placing {{head|1.1}} on MyPage, put it on MyPage/Subpage1 and then transclude that into MyPage in the usual way ({{:MyPage/Subpage1}}).
{{head}} can then include a custom edit link to the template input by using HTML heading tags (<h2> is equal to ==, etc.) to suppress the standard edit link and then use one of these templates (probably {{ed right}}) to create a custom edit link pointing to MyPage/Subpage1.
The way to create anchors in Mediawiki, by the way, is to use a <span id="name"/> tag, but that doesn't create a container that can be edited (or at least, not that I've been able to work out through URL tinkering).
I'm pretty sure there's no way to do that. As far as MediaWiki's section editing feature is concerned, the only thing that begins a new section is a line of the form:
=== Some text here ===
with the number of = signs determining the level of the heading. There's no way to get MediaWiki to let you edit any segment of the document that doesn't begin and end with such a line (or the beginning or end of the page).
Well, OK, I'm sure you technically could do it with an extension, in the sense that you can do anything with a MediaWiki extension. All you'd need to do is provide some way (e.g. a special parameter in an edit URL) for to user to indicate "I want to edit this template", then extract the template from the wikitext, present it to the user for editing, and write the result back into the page text over the original.
The tricky part will be extracting the template from the page source. (Finding and replacing templates on a page is a fairly common task for MediaWiki bot writers, so you might want to look for ideas there.) Whatever method you end up using for that, there will probably be edge cases where you need to give up and tell the user "Sorry, but I can't figure out how that template is transcluded here."

og:title doesn't correpond with the one I set

I have a question regarding the meta property in php.
I have set
and I have a list of products that need to be displayed on the first page. Whwn I click the first product and click the like button the title that appears is different from the one I set, but when I click the other products and then click like I get the correct title. I tried clearing the cache but it didn't work and I tried verifying the link using http://developers.facebook.com/tools/debug and here it teels me that the title is the one I set.
Can anyone tell me what am I doing wrong or what might be the problem? Or maybe you have a soultion for this. :D
Thanks!
Without seeing the page which is being changed and liked, it's hard to know if I am answering your question, but the information may be useful to you anyway.
The issue may be with how many likes have already added up for the page.
Note that og:title and og:type are only editable initially - after
your page receives 50 likes the title becomes fixed
Source: https://developers.facebook.com/docs/opengraphprotocol/
This has happened to me before. The easy fix/workaround I found was this: I had been appending a query string to the page URL for tracking some stats. That URL with the query string had over 50 likes. Once I changed the query string, or left it off, the page had a different amount of likes. So when I used the Facebook linter/debugger, I used the new URL and it picked up my og:title and description change.
Are you able to post a link to the page you are having this issue with?

MediaWiki : is it possible to add an edit link in a template?

I have a template on my wiki, kind of a box template.
Then, there is this page where I use it several times.
Can I add an edit link to each of the boxes so I don't have to edit the whole page in order to modify one of the boxes?
The boxes contain only text, not other templates.
Thanks!
Edit: Actually there's an easier way to ask my question:
Let's say I have a page without sections defined (namely without == titles ==):
content A
content B
content C
Is there a way to open an edit form only for content B?
"Is there a way to open an edit form only for content B?" - in standard mediawiki - no, but you can do sth like this
Main page will look like this:
{{/subpageA}}
{{/subpageB}}
{{/subpageC}}
subpageA will contain link to edit subpageA etc
But it is worse than sections in every possible way.
If I understand your question, and I'm not sure I do, I'm assuming your box is a div or table of some sort? If so, you could add id="{{{1|Some identifying parameter}}} to it.. Now, similar to if you had used == header 2 == you will be able to link to that section of the page with [[{{PAGENAMEE}}#{{{1|Some identifying parameter}}}]]. The only trick is to edit that section. You would likely have to set up a <span class=plainlinks>[http://somewiki.com/edit/{{PAGENAMEE}}&section={{{1|Some identifying parameter}}}]</span> Although, I'm not sure using the section name will work on your wiki, it works on only one of four that I edit. The other three require the section number, which may be harder to figure out, or at very least is beyond my pay-grade atm..
Not sure what you're asking here. Do you want to edit the template from the referring page?
Update:
One: The ugly but simple solution:
Add the following code above the text you want to edit:
=== ===
This will create a section with no name, but with an edit link. If you make four or more of these links, you will create a TOC in the page. You can suppress this with:
__NOTOC__
Two: The neat but extensive solution:
Make your wiki semantic and use Semantic_Forms to edit the page using a form.
Not with the standard installation.
But, I'm sure you could write an extension to do this. Eg. Right click on the page and it will start editing there.
It is possible to add link to edit template, so you can make ugly hack and create separate templates/subpages for every single box.