YOU CAN EDIT THIS PAGE! Just click any blue "Edit" link and start writing!

Template talk:BASICPAGENAME

From Wikitravel
Jump to: navigation, search

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. 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
Texugo 20:09, 15 December 2008 (EST)
SUBPAGENAME should be a start, if does half of what you want. --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. 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. =) LtPowers 21:50, 16 December 2008 (EST)

Good idea. Will do. 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? --Inas 23:13, 17 December 2008 (EST)
Just tried that. It doesn't appear to remove parentheticals. Texugo 23:20, 17 December 2008 (EST)
Okay, What about {{#explode:{{SUBPAGENAME}}| (|0}}. See User:Inas/one two three (four) Thanks for your patience. --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. 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. 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. Texugo 00:16, 18 December 2008 (EST)

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