DRY Up Your SWF SEO
Bobby | Friday, February 01, 2008
<li><a href="/" class="selected">Home</a></li>
<li><a href="/about/">About Us</a></li>
<li><a href="/contact/">Contact Us</a></li>
Next, our page needs some content. It may have images, paragraphs, bulleted lists and some formatting. It's not XML, so we'll want to keep the tags that lend the formatting.
This basic HTML has created a great foundation for our site. Screen readers, search engines, and iPhone users will all be able to enjoy our content. But for folks with Flash, we can make the experience even better. If we place the nav and content divs inside a wrapper div, SWFObject can replace the contents of the wrapper with our nifty Flash movie.
Getting started, that unordered list nav looks very familiar as HTML, but it also looks like something else XML. So why don't we load this XML into our Flash movie? It even tells us which page we're on (via
class="selected"). That will allow great flexibility with the design of the nav in Flash. Using SWFObject, it's as simple as this:
Now we should feed the content into Flash the same way as the faux XML nav:
All that's left is to parse the XML for the nav and render the HTML from the content. Executions will vary, but this should get us started:
// Parse the xml content
XML.prototype.ignoreWhite = true;
var myXML:XML = new XML();
var rootNode:XMLNode = myXML.firstChild;
// Set the html content
_root.content_txt.htmlText = _level0.html_input;
This method allows the developer to spend more time building a sound, accessible site and less time creating XML schemas to load in duplicate content for two presentations. Flash supports a good subset of HTML tags as well as custom CSS, so you should be able to match most of the usual content formatting.
Bobby Uhlenbrock, Application Developer, Barefoot