Jump to content

Template talk:BASICPAGENAME

Page contents not supported in other languages.
Add topic
From Wikivoyage

PAGENAME function

[edit]

Archived from the Pub:

Is there a function similar to {{PAGENAME}} that doesn't include parentheticals like (city) and doesn't include the hyphen or things before it? i.e. would display "Deep Ellum" instead of "Dallas/Deep Ellum", or "Vernon" instead of "Vernon (Texas)"..? I should think it would be useful if there were but have no idea how to make one. (WT-en) Texugo 19:58, 15 December 2008 (EST)

Thinking a bit more, surely something like this must exist, since the page name fed to the browser window doesn't include these. I was primarily thinking that if there were such a function or if someone could make one, we could plop it into our article templates, and it would eliminate the all-too-frequent occurences of new contributors making an article and forgetting to fill in the blanks, resulting in new pages that literally begin with, for example,
City name is a city in Region name
(WT-en) Texugo 20:09, 15 December 2008 (EST)
SUBPAGENAME should be a start, if does half of what you want. --(WT-en) Inas 21:03, 15 December 2008 (EST)
This doesn't quite work but maybe it'll spark another idea. On a non-subpage, the code [[{{subst:SUBPAGENAME}}|]] should do what you want; only problem is that this will render as a wikilink (although as a wikilink on its own page renders on bold and as that's what you want in the lead sentence, not a big problem); however, on a subpage it'll render as a link to a different page, which is a problem. (WT-en) JYolkowski 22:46, 15 December 2008 (EST)

I couldn't find any MediaWiki magic word that removes disambiguators. It does seem like there must be a function somewhere, though, for the reason you stated. Might want to ask around at the Shared pub where the tech guys hang out. =) (WT-en) LtPowers 21:50, 16 December 2008 (EST)

Good idea. Will do. (WT-en) Texugo 02:14, 17 December 2008 (EST)
What about {{#explode:{{SUBPAGENAME}}|{|0}}, am I getting warmer, or do I still need to refine the spec document? --(WT-en) Inas 23:13, 17 December 2008 (EST)
Just tried that. It doesn't appear to remove parentheticals. (WT-en) Texugo 23:20, 17 December 2008 (EST)
Okay, What about {{#explode:{{SUBPAGENAME}}| (|0}}. See User:(WT-en) Inas/one two three (four) Thanks for your patience. --(WT-en) Inas 23:53, 17 December 2008 (EST)

Maybe a good idea but with districts I think we should still have the city's name, but maybe not a slash. IE: Dallas Deep Elm or Deep Elm , Dallas instead from Dallas/Deep elm. (WT-en) edmontonenthusiast [ee] .T.A.L.K. 00:10, 18 December 2008 (EST).

Might want to rethink that, ee. The first sentence always gives you that information anyway. It's pretty redundant to say "Dallas Deep Ellum is a district of Dallas", not to mention ungrammatical. (WT-en) Texugo 00:14, 18 December 2008 (EST)

I'm going to implement this template inside the header of the routebox template to get rid of the need to manually type the placename in. Thanks again, Inas. (WT-en) Texugo 00:16, 18 December 2008 (EST)

Is it working okay? Should we use the same function in the article template? --(WT-en) Inas 17:59, 23 December 2008 (EST)

IMPORTANT: explode function not available on Wikimedia wikis!

[edit]

This template has to be changed to not use #explode, as string functions are not enabled on Wikimedia wikis. I will be asking around on Wikipedia for alternatives. LtPowers (talk) 15:15, 25 October 2012 (CEST)

Well, that didn't take long. Here's wikipedia:Template:PAGENAMEBASE, which does exactly what we want. The trick is it makes use of a couple of ad-hoc string-parsing templates that would also have to be imported from Wikipedia. I don't know if I understand how they work well enough to maintain them. LtPowers (talk) 15:22, 25 October 2012 (CEST)

Admin request

[edit]

Swept from the pub:

Could an admin use the replace text extension to do the following replacement?

replace:

'''{{#explode:{{SUBPAGENAME}}| (|0}}'''

with:

'''{{subst:#explode:{{subst:SUBPAGENAME}}| (|0}}'''

It would make a change similar to the one here. sumone10154(talk) 01:55, 27 October 2012 (CEST)

I started the job off, though I don't know if the "subst" will work on a ReplaceText. We'll find out. If not, you've got 88 pages to manually edit. =) LtPowers (talk) 04:04, 27 October 2012 (CEST)
Well whaddya know; it worked. I also fixed three other pages that used SUBPAGENAME incorrectly. I think that just leaves Template:BASICPAGENAME that still uses #explode. LtPowers (talk) 04:13, 27 October 2012 (CEST)
Hang on, can't you use #titleparts to accomplish this task? 203.217.76.167 06:49, 27 October 2012 (CEST)
#titleparts only separates by slashes. We also need to strip out the parenthetical disambiguators. LtPowers (talk) 19:18, 27 October 2012 (CEST)