Page and Box Titles

Problem

Page titles are a really important element of Search Engine Optimization, and they also provide users with better bookmarks and history list entries. How can I set titles for the different pages in my app?

Solution

Use the fb:title tag to set the title of your page. When used on a Canvas page, this will append the included text to the title of the window. The simplest form is:

<fb:title>Title Here</fb:title>

If your app is called “Super Disco Napping,” and you set the fb:title to “Invite Friends to Nap,” and you’re running Firefox 3 on Mac OS X (which you should be!), the window title bar will look something like Figure 6-12.

Window title

Figure 6-12. Window title

You can also use the fb:title tag to set the title of the various boxes you can place the tag in, including Profile Boxes and the like. When used inside of a wide Profile Box, you’ll get something like Figure 6-13.

Profile Box text

Figure 6-13. Profile Box text

Discussion

The fb:title tag is often used with the fb:subtitle tag to create a header like the one you’ll see in Profile Boxes on users’ Profiles. For example, the following:

<fb:title>Super Disco Naps</fb:title> <fb:subtitle seeallurl="http://apps.facebook.com/superdisconaps/all"> Displaying 10 of 2587 naps <fb:action href="http://apps.facebook.com/superdisconaps/nap.php"> Take ...

Get Facebook Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.