Dynamic Page Titles

Xaraya has the ability to create dynamic page titles with every page view. Many of the other CMS packages out there allow you to create titles based on the articles, but very few give a webmaster the ability to pick and choose the format, and dynamically create the titles from each module view. This depends on the module author fulfilling their part on some of the more subtle functionality within Xaraya as well as the webmaster configuring the output. Both PostNuke and PHP-Nuke have this functionality in their "news" modules; however, both lack the ability to configure the output, as well as allow the functionality to be used through-out each module. What good is a review of an album or movie that can not be found from a search engine?

Why page titles are important is a good question to ask. Page titles give you more bang for your buck with search engine optimization than any other minor enhancement you can make with your website. There are tons of SEO tricks out there, but there is none simpler than allowing a rational amount of keywords to be a part of your page title. Xaraya also produces dynamic keywords based on the article content to be able to be produced, however these are not as an effective tool as allowing the page title to be dynamic.

Configuration

Most core and base Xaraya modules change the title by default based on an assumption of the title. The way your website displays the title is configurable from the themes module. If you go to your Themes -> Admin -> Modify Configuration you will see two options for setting the way your page title is displayed. The first option is the separator used in the page title. By default this is :: , thus producing a page title here of:


Wyome :: Plain and Simple

We could make this separator any thing though. You could even use entities to produce a triangle or another shape which will be shown on many search engine results.

The second configuration step is to tell your website how to display the title. The idea here is simple. You have a site logo and site title, both configurable from the themes admin. Likewise many modules in Xaraya are going to tell Xaraya what the title of an article, or piece of content, exactly is. What you need to do is decide exactly how you want to display that information.

Module Development

The title is a variable that is set on individual functions within a module that outputs to either an admin or user display. In the API, there is a very simple call that module developers need to make in order for Xaraya to know what to call an individual page:

xarTplSetPageTitle is what does the magic here. It sends a variable to Xaraya to tell it to set the page title to be whatever it should be. In this case, we are using $title as the variable to hold information about the title of the content. xarTplSetPageTitle also will accept the module information as well as a second input.

If you are sending a variable, you will want to make sure that the xarVarPrepForDisplay is called as well. This will strip any HTML call that might be held within the variable. You would not want a page title calling a link or other tag, as the search engines probably would not understand the meaning, and likewise your module display will be generating display that is not particularly clean.

This call should be used on any user type display. You do not need to make the call within the admin areas of Xaraya, as search engines are not likely to be crawling these areas (with a normal privilege set-up). Each function should change the title of the page, as this will create a descriptive title for the search engines to display, and thus used to weight the results.

Print | Related