How do I define the article title in MediaWiki? - mediawiki

I'm talking about using the wiki syntax. Normally, I create an article by making a link and then editing it, such as
[[secure-auth|Secure 2-Factor Authentication]]
But this results in the article being titled "secure-auth" on that page. I want the URL to be foo.com/mywiki/secure-auth , but the article title to be "Secure 2-Factor Authentication".

You can't have an article with URL different from the article title. But there are some ways to work around that:
Create a redirect from “secure-auth” to “Secure 2-Factor Authentication”.
Use {{DISPLAYTITLE}} to modify how the page title looks like.
Configure your web server (most likely Apache or IIS) to rewrite the URL the way you want.

Related

Can you remove /pagetwo from a multipage website?

If you a have a multipage website for example www.examplesite.com
and you have a few pages : www.examplesite.com/pagetwo etc...
is it possible to remove the /pagetwo from the searchbar? or present this in a cooler way. I suppose www.examplesite.com/2 is more minimal, but is there any way to completely remove this?
Many Thanks
Harry
You can manipulate the state of the URL via JS like this:
history.pushState("object or string", "Title", "/");
Read more here: http://spoiledmilk.com/blog/html5-changing-the-browser-url-without-refreshing-page/
In the variation above, the last bit ("/") says push the URL back to site root.
But I'd recommend asking why you want to do this and if it's the best solution. You could easily create bad user experiences and prevent people from bookmarking or sharing the content they intend to.

Set a custom title for all pages in MediaWiki?

I enabled the configuration variable "SubPages" in my MediaWiki.
Now I would like the following markup to be automatically placed on all pages.
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
In general, I want to customize my title pages.
Looks like mw.config has no access to subpage name, but in your custom JavaScript you could still use mediaWiki.message to parse a custom string like your {{DISPLAYTITLE:{{SUBPAGENAME}}}} and then replace it to the title and main h1.
This is a bit silly though, you could look into BookManager extension and other Wikisource/Wikibooks tricks to see how they handled subpages at scale.

Getting talk page title using mediawiki API

Is there any way to fetch the talk page title of a given page title through MediaWiki API?
I know that I can get talkid using prop=info. But the problem is that there is no pageid for a talk page that does not exist yet. Also there are some obvious ways to get talk page title by adding a prefix to subject title, but it seems to me that they are all language/setup dependent...
leo's answer: So, given a title, that might not exist, you want to know what the talk page would be if the page was created, in a wiki with custom namespaces that you do not know? Then I would just have grabbed the list of all namespaces from the API: http://www.mediawiki.org/w/api.php?action=query&meta=siteinfo&siprop=namespaces, and looked my prefix up there. The talk page namespace will be in NS+1.
(Posted as community wiki so that this question isn't listed as unanswered.)

Twitter Share extra text

I'm building my own Twitter share link as explained here:
https://dev.twitter.com/docs/tweet-button#build-your-own
The URL that I'm sharing will look something like this sample URL:
https://twitter.com/intent/tweet?url=http://www.google.com&text=I%20just%20shared%20my%20link%20using%20#eckroth%20-%20Check%20it%20out:
My question: How can I add text after the URL with some other information? The URL param sticks itself at the very end of the share string:
"I just shared my link using #eckroth - Check it out: http://www.google.com"
I want it to be something like:
"I just shared my link using #eckroth - Check it out: http://www.google.com - Some other text here!"
Sorry, Joel, but you can't do that with the Web Intents API, which is what the sample URL you provided posts to. Check this out: https://dev.twitter.com/docs/intents.
If you scroll down to "Supported parameters", you'll see the description for the url parameter, which states that it will be shortened and "appended to the end of the tweet". So we have no control over where the URL goes if we give it to Twitter to take care of.
That said, you could simply include the URL in the text, yourself. Before Twitter made their own URL shortener, that's how we used to do it. Pass it through http://bit.ly or similar and then include the resulting URL wherever you want to in the text.
Note - the way your self-shortened links will be rendered on-screen in the timeline may not carry the same authority as a URL you pass to Twitter, though, so you may want to do both.
Good luck!

Is this a valid sitemap URL?

I have thousands of uique urls that look like this:
<url>
<loc>http://my_site_url/view_profile=1577</loc>
<changefreq>daily</changefreq>
</url>
are these urls that google or any other SE will crawl?
Yes, those links will definitely be crawled, but you should ensure that in addition to your sitemap they are in some way properly linked. Could the urls be improved? Definitely, in the following ways:
Seperate words with dashes, not underscores
Make use of url rewriting to change that = to a /
You may also want to consider using a username rather than profile number. You might find Google's Article on URL Structure interesting as well.