Make search engines love PHPmotion (part 1)

This is part one of an as of yet undetermined amount of posts in which I will try to explain how to improve your search engine rankings for your PHPmotion website. I probably won’t be covering the actual marketing but will be providing code, ideas & examples of ways to improve your website.

Let me know if you find it useful and I’ll get started on more posts!

Do not use duplicate title & meta tags!

This is easily missed as the keyword & description tags are invisible to regular visitors, they only show up within the source code. Having the same titles on different pages is missing out on a great opportunity for getting some keywords picked up in search engines.

For example the featured, recent, most viewed & most commented videos all have the same title & meta tags! This is not good!

Here’s a simple way of fixing this and can be used in pretty much any of the .php files:

$page_title = "Your page title will go here! - $site_name";
$description = "Enter a description for the page here, descriptions are often used as the small part of text that shows in search results and shouldn't exceed 150 or so characters (the amount Google display in results).";
$keywords = "comma,separated,words,or short, search keywords";

Meta keywords aren’t used so much now as the search engines prefer to scan the actual content of your page rather then trust what you enter.

So where do you stick this code into your files? Most of the time anywhere before this will be fine except in certain files (more on that in a bit):

$TBS 			= new clsTinyButStrong;

Try it out now in category_home.php.

But wait I hear you say, I want to display the name of the category! Good thinking! So here’s how you go about it, take the code had earlier with a few minor adjustements:

$page_title = "Watch $channel videos – $site_name";
$description = "View all videos in the $channel category, watch, rate and comment on $channel videos.";
$keywords = "$channel, $channel videos, popular $channel vids";

Now that’s much better. Of course you can (and should) take this a lot further. Remember you will need to replace $channel with other variables (and don’t forget to change the descriptions & keywords around a bit). Some pages not to miss are seemore.php ($see_more_title), audio.php (also $see_more_title).

If you find this useful let me know below! Any questions just ask!

Update: How to add this for sub categories
At the bottom of the file just before adding the above code add the following:

if($sub > 0) {
	$channel = $channel_name;
}

, ,

23 Responses to “Make search engines love PHPmotion (part 1)”

  1. [...] to add? Search engines will love it, users will too. Add this to a smart bit of marketing and some optimized seo and watch your site [...]

  2. Ryan says:

    This works great, but I’m having a problem using this with subcategories. Do you know what the additional PHP is to sort out the subcats?

    Thanks!

  3. Ben says:

    Ryan, I’ve updated the post with code to solve this. :)

  4. [...] 2 of the PHPmotion seo series is now done (part 1 here)! In this article I will be concentrating on improving the .htaccess file to remove duplicate [...]

  5. Naija says:

    I modified the files but when I browse any of the pages, I still get the the same title; I ran a few test and noticed that the tag in Main_1.htm is being used and the changes I made in each of the files are being ignored

    Any thought?

    Thanks
    Naija

  6. Naija says:

    I also found this in the config.inc.php… “OVERALL GENERAL META NAMES Description AND Keywords SETTINGS
    IN main_1.html THESE ARE RE-SET while viewing media dynamically”

    But the description and keyword settings in MAIN_1.htm does not appear to be resetting when loading media dynamically

  7. tamilbot says:

    Nice post, thanks for good tips

  8. Ehsizzup says:

    @Naija @ben This will fix the issue that Naija mentioned.

    I think that line #3 of your code should read….

    $tags = “$channel, $channel videos, popular $channel vids”;

    Note I changed $keywords to $tags.

    P.S. I have no clue what I’m doing with PHPmotion so I could be wrong.

  9. ccspruce says:

    I am not able to follow the instructions here. Can you be a little more specific about which file one needs to insert the lines:

    —————————-
    $page_title = “Your page title will go here! – $site_name”;
    $description = “Enter a description for the page here, descriptions are often used as the small part of text that shows in search results and shouldn’t exceed 150 or so characters (the amount Google display in results).”;
    $keywords = “comma,separated,words,or short, search keywords”;

    ——————————————–

    It is obvious that I am missing something here. I really have no clue about the above described instruction. I would appreciate some advice here. Thanks.

  10. Ben says:

    You can add that into most of the php files in the base folder of where PHPmotion is installed. Files like seemore.php, audios.php, etc. can all use this but you need to be careful where it is placed as the same file is used for the most recent, featured, etc. and you may want different titles for each type.

    If you need help on where to place the code in a particular file let me know.

  11. ccspruce says:

    Ben,

    Thanks for your reply. Indeed, I do need help on where to place the code. Also, how does on test whether the code was working in our website? I have tried to place the code just after the “include_once (‘includes/enabled_features.php’);” line at the beginning of the catagory_home.php file, since you said that it was ok to place the code anywhere before the line “$TBS = new clsTinyButStrong;”.

    Am I correct in understanding your instruction???

    I am having trouble the instruction on sub categories as well. Is it to be placed before the “$page_title” insertion?

    Thanks.

  12. Ben says:

    In category_home.php you will need to place the code near the end. You should have something like this near the bottom of the file:
    $page_title = $lang_browse_videos . ' ' . $channel . ' ' . $lang_videos . ' ' . $lang_on . ' ' . $site_name;
    You would replace that with the above code and use the $channel variable where you’d like the channel/category name to appear.

    For the sub categories simply add the code in the bottom of the post just above this part and it should work.

  13. ccspruce says:

    Thanks for the replay. I think I did exactly what you suggested (see below), but I am NOT sure how to check whether the changes are in effect. Are the page_titles supposed to show up somewhere? Please advise.

    Thanks.

    In the category_home.php file, I replaced:

    ——————————————————————————-
    $page_title = $lang_browse_videos . ‘ ‘ . $channel . ‘ ‘ . $lang_videos . ‘ ‘ . $lang_on . ‘ ‘ . $site_name;
    ——————————————————————————-

    With the following lines:

    ———————————————————————————
    if($sub > 0) {
    $channel = $channel_name;
    }
    $page_title = “Watch $channel videos – $site_name”;
    $description = “View all videos in the $channel category, watch, rate and comment on $channel videos.”;
    $keywords = “$channel, $channel videos, popular $channel vids”;
    ————————————————————————————

  14. ccspruce says:

    Ben,

    I think I should be more specific on my questions. I expected the “$page_title” line to show up somewhere in the webpage heading, but it didn’t. My webpages of our video channel (domain/category/) still shows the heading of our homepage.

    If you can comment on how the codes of the category_home.php file is used in the phpmotion, that will help us understand the system better. In other words, is there a html file that directly associated with the category_home.php?

    Thanks.

  15. Ben says:

    Sorry for the delay I thought I’d replied to this already. The change in this post should change the text in the <title> tag. The html template file for category_home.php is themes/yourtheme/templates/inner_category_home.htm

  16. ccspruce says:

    Ben,

    As I mentioned in my earlier posts, we actually don’t see any changes in the tag of our domain/category webpages. They all show the title heading from the main_1.html file. I guess we don’t understand how your code changes could be reflected in the domain/category webpages. Can you please help us by pointing out the code line in the inner_category_home.html that is associated with the category_home.php file and how your recommended changes would result in tag changes in the inner_category_home.html?

    Thanks,

  17. Simon says:

    Hey Ben

    Im trying to figure out these SEO changes, but i keep seeing code that looks similar. Im using V3.5, have these already been applied to the lastest version?

  18. ccspruce says:

    Ben,

    I haven’t heard your response in almost 3 weeks. Are you still responding to this board? Thanks.

  19. Ben says:

    @ccspruce, I’ve been really busy lately and forgot about your comment. It’s strange that you’re not seeing any changes. If you can email me your category_home.php file I’ll take a look and see what’s not changing.

    @Simon, which files are you seeing similar code in? Most files already have the $page_title but apparently not the keywords or descriptions.

  20. mike says:

    hi,
    i have the same problem as ccspruce, no changes reflected in featured, recent, most viewed & most commented videos.

    mike

  21. ccspruce says:

    Ben,

    Thanks for your reply. I have just emailed you a copy of our category_home.php file with your suggested lines. Look forward to your reply.

  22. ccspruce says:

    Ben,

    Thanks for reviewing code files for us. Thanks to your help, the page title of our website now functions as you described. Terrific job.

  23. Hi.

    I already did your tutorial for category_home.php

    Can you please teach me how to do it for seemore and audio.php?

Leave a Reply

RSS feed