Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
pagination and meta titles
Hi all,
I need to be able to show the page number in the (meta) title of the page. Does anyone know how to do this please?
Many thanks :)
0
This discussion has been closed.
Comments
$Page = ForceIncomingInt('page', 1);
I realized this isn't truly proper, as there is one case (coming from a search result) where you can be on a secondary page without the page querystring appearing in the URL.
So understanding that, this will work for the other 95% of the time when the page is defined in the URL:
$Page = ForceIncomingInt('page', 1); // Figure out what page we are on $Headlinks = '<link rel="first" href="[first url]"/>'; // First page in the sequence if ($Page > 1) { $Headlinks .= '<link rel="previous" href="[previous url]"/>'; } $Head->AddString($Headlinks);
The code is from a old extension idea of mine to add link headers to support link bars in browsers. Many more link types to add than what I have here.
That example is probably a bit simplistic, so here are some more extension examples. The $Head object, while different, works similarly enogh as the $Panel object for you to do what you want.
Funny you should say that, I recently set up a Google custom search gadget and while testing it, I found the Google search results included results from a Vanilla search. Very odd, are Vanilla searches saved somewhere in a cache that Google is able to scan?
Then turn it on just like any other extension.
Wanderer: Google's bot doesn't itself perform serches, but if someone else did a search, and posted the search URL somewhere Google would see it, then it would appear in Google's search results. You could probably add a noindex meta tag on the search pages if you didn't want this to happen.
<?php /* Extension Name: Meta Page Number Extension Url: The url to where this extension can be downloaded Description: Adds a meta tag with the page number Version: beta Author: Your Name Author Url: Your personal url */ $Page = ForceIncomingInt('page', 1); // Figure out what page we are on // First page in the sequence $Headlinks = '<link rel="first" href="[first url]"/>'; // This block of code only runs if the page number is greater than one if ($Page > 1) { $Headlinks .= '<link rel="previous" href="[previous url]"/>'; } $Head->AddString($Headlinks); $Head->AddString('<meta name="PageNumber" value="' . $Page . '">"'); ?>
I will look into the error, when I get home but am not quite sure what it could be at this point.
$Page = ForceIncomingInt('page', 1); // Figure out what page we are on
Replace $Page by $CurrentPage in default.php.
$Head->Meta['PageNumber'] = $CurrentPage;
When you talk about the meta title, are you talking about the title tag?
I've also been using the MetaTags add-on.
For example, on my account page I get:
<head> <title>Mentor Community - My Account</title> <link rel="shortcut icon" href="/Vanilla.1/themes/Digg/styles/Digg-RP/favicon.ico" /> <meta name="Description" content="Profile of My beautiful members" />
Then after the link and style tags, I get:
<meta name='keywords' content='contest, Christian, free, contests, winners' /> <meta name='description' content='This forum is great!' /> <link rel="first" href="[first url]"/><meta name="PageNumber" value="1"/></head>
Bottom line is that I have not gone back to this to get it exactly the way that I would like it.