tip for SEO on Pod Pages
I posted this yesterday on the UI forum, might post it here as well:
To have custom keywords and descriptions for pod-pages, you can display the meta keywords, and meta description tags like this:
Put this in the precode-field on the pod-page.
<?php
function podsseometa() {
$id = pods_url_variable(-1);
$poddesc = 'List of all recommended places in ' . ucfirst($id) . '. ACME Inc Magazine recommends the best locations to stay to its readers '; // customize to your needs of course
$podkeys = $id . ', recommended, places, ACME, Magazine, awards '; // customize to your needs of course
echo "<meta name='description' content='" . $poddesc . "' />\r\n";
echo "<meta name='keywords' content='" . $podkeys . "' />\r\n";
}
add_action('wp_head', 'podsseometa');
?>
Further, you might include a field for description and one for keywords in the pod itself. Retrieve those fields and display them instead similarly as shown above..
edited Aug 10 '10 at 9:49
2 Answers
This works great for me.
Just want to suggest a bit modification:
$poddesc = "List of all recommended places in " . ucwords(str_replace("-", " ", $id)) . ". ACME Inc Magazine recommends the best locations to stay to its readers "; // customize to your needs of course
$podkeys = ucwords(str_replace("-", " ", $id)) . ", " . ucwords(str_replace("-", ", ", $id)) . ", recommended, places, ACME, Magazine, awards "; // customize to your needs of course
This will make the meta description become more SEO friendly, also you will have the meta keywords become richer than before.
edited Sep 8 '10 at 4:21
your code worked fine. just a note tho, if you already have a meta description field in your pod, don't forget to use the global feature in the function
function podsseometa() {
global $pods;
$id = pods_url_variable(-1);
$poddesc = $pods->get_field('meta_description');
$podkeys = $pods->get_field('meta_keywords');
echo "<meta name='description' content='" . $poddesc . "' />\r\n";
echo "<meta name='keywords' content='" . $podkeys . "' />\r\n";
}
