Tag: xml

Custom OpenSearch Functionality for Your Website

Posted on December 7, 2008 in Function, Websites by Jeff Starr

I recently added OpenSearch functionality to Perishable Press. Now, OpenSearch-enabled browsers such as Firefox and IE 7 alert users with the option to customize their browser’s built-in search feature with an exclusive OpenSearch-powered search option for Perishable Press. The autodiscovery feature of supportive browsers detects the custom search protocol and enables users to easily add it to their collection of readily available site-specific search options. Now, users may search the entire Perishable Press domain with the click of a button.

And you can do it too! Adding customized OpenSearch-powered search functionality to your own site is a great way to foster site awareness and reinforce brand identity, while providing a tool that will benefit your visitors and improve the usability of your site. Even better, implementing OpenSearch functionality is extremely easy, completely free, and requires zero maintenance. In this article, I provide an easy, 3-step tutorial on how to add OpenSearch functionality to your site in less than five minutes. After the tutorial, we will look at the many different ways to customize your OpenSearch implementation, including examples, search options, and much more.

Continue Reading

Content Negotiation for XHTML Documents via PHP and htaccess

Posted on March 26, 2008 in Function, Standards by Jeff Starr

[ ~:{*}:~ ] In this article, I discuss the different MIME types available for XHTML and explain a method for serving your documents with the optimal MIME type, depending on the capacity of the user agent. Using either htaccess or PHP for content negotiation, we can serve complete, standards-compliant markup for our document’s header information. This is especially helpful when dealing with Internet Explorer while serving a DOCTYPE of XHTML 1.1 along with the recommended XML declaration.

According to the RFC standards 1 produced by IETF 2, web documents formatted as XHTML 3 may be served as any of the following three MIME types:

Continue Reading

An Easy Introduction to Web Feeds

Posted on March 11, 2008 in Technology by Jeff Starr

This article will help beginners understand a few “feed” essentials: what they are, how they work, and how to use them..

[ Icon: Standardized Orange Feed Icon ] So you are a little new to the Web. As you surf around, you keep noticing these little orange squares and multicolored boxes placed next to phrases such as these:

  • Subscribe via RSS
  • Subscribe via XML
  • Subscribe via Atom
  • Subscribe via Feedburner
  • Subscribe to My Feed
  • Subscribe to Main Content
  • Subscribe to Comments

..and so on. Although these invitations to “subscribe” come in many flavors, they are all basically doing the same thing: enabling visitors to receive information from the site without having to manually visit the site itself. By subscribing to your favorite sites, you can stay current with updated content delivered to the “feed reader” of your choice. There are many feed readers freely available around the Web. In many cases, you can even have feed subscriptions delivered directly to your email account. We’ll talk more about different types of feed readers here in a bit. For now, let’s examine a few different types of feeds and how they might be used.

Continue Reading

Error-Free Feed-Validation Links for Feedburner-Redirected Feeds

Posted on February 17, 2008 in Structure by Jeff Starr

Just a quick tip on how to create error-free links to feed validation services for feeds that are redirected through Feedburner. For example, let’s say our site’s main feed is originally located at:

http://domain.tld/feed/

If we wanted to provide our visitors with a link that would enable them to automatically validate our feed using a free service such as feedvalidator.org 1, we would create the link as follows:

Continue Reading

Laser-Focused Feeds and Smarter Feed Management

Posted on January 28, 2008 in Websites by Jeff Starr

[ ~{*}~ ] My current adventure into the fascinating realms of site redesign and optimization has yielded several chunks of fruit related to managing and delivering feed content. One of my primary concerns regarding the overhaul of Perishable Press is streamlined content delivery and rights management. An important area of convergence for these two factors involves the management and delivery of a site’s syndicated content. In this article, I explain the shortcomings of many default feed configurations and present an effective overall strategy for better feed management.

When it comes to managing syndicated content, most blogging platforms enable bloggers to provide a multitude of feeds to their readers. For example, WordPress (as well as many other blogging platforms) automatically generates feeds for each of the following channels:

  • Main content feed (includes all posts)
  • Main comments feed (includes all comments)
  • Unlimited number of individual category feeds
  • Any combination of individual category feeds as a single feed
  • A feed for each the comments given for any particular post
  • A feed for each blog author or contributor
  • A feed comprised of virtually any combination of the above feeds

Then, as you consider this astronomical number of feeds, multiply each possibility by a factor of at least three: feeds generated via RSS 2.0, RSS 0.92, and Atom formats. Then, as if that were not enough, some bloggers throw third party services such as Feedburner into the mix and link directly to those feeds as well. Now add a zillion non-canonical URL variations into the mix. Eventually, your eyes begin to bug out and you go a little bonkers trying to keep track of them all.

Continue Reading

What is the Difference Between XHTML 1.0 Strict and XHTML 1.1?

Posted on January 27, 2008 in Structure by Jeff Starr

As some of you (e.g., Louis) may have noticed during the recent site redesign, I decided to switch the default doctype from XHTML 1.0 Strict to XHTML 1.1. Just in case you were wondering, XHTML 1.1 is different than XHTML 1.0 in three important ways 1:

  1. On every element, the lang attribute has been removed in favor of the xml:lang attribute
  2. On the a and map elements, the name attribute has been removed in favor of the id attribute
  3. The “ruby” collection of elements has been added

Beyond these three differences, XHTML 1.1 is identical to XHTML 1.0. Personally, I chose to markup my current design with XHTML 1.1 because of its advancement of the web-standards paradigm: complete separation of structure, behavior, and presentation.

References

How to Add Meta Noindex to Your Feeds

Posted on December 2, 2007 in Websites by Jeff Starr

Want to make sure that your feeds are not indexed by Google and other compliant search engines? Add the following code to the channel element of your XML-based (RSS, etc.) feeds:

<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />

Here is an example of how I use this tag for Perishable Press feeds (vertical spacing added for emphasis):

Continue Reading

New Version of Category LiveBookmarks Plus for WordPress 2.3

Posted on October 16, 2007 in WordPress by Jeff Starr

Category LiveBookmarks Icon
CLB+
As many WordPress users now realize, there have been many fundamental changes in the new version of WordPress. The latest version of WordPress — 2.3 — features a considerably revamped database structure, including a complete reorganization and redistribution of the wp_categories table. Unfortunately, such database alterations have rendered inoperable many popular plugins, proving quite unfortunate not only for millions of WordPress users, but also for those of us who donate time, effort, and resources toward the development of freely available WordPress plugins. Thus, with the advent of WordPress 2.3, developers whose plugins have ceased to function must now decide whether or not to continue their support. In my humble opinion, philanthropic plugin developers have several choices:

Continue Reading

Feed your Image via Atom or RSS

Posted on February 4, 2007 in Function, Structure by Jeff Starr

This quick tutorial explains how to add images to both Atom and RSS feeds. Although both formats allow for image-inclusion, feed-reader support for image-display is currently quite limited. Hopefully, that will change in the near future..

Images for Atom Feeds

Images included within Atom feeds must have a ratio of either 1:1 or 2:1. There are no other restrictions as to file type or size. Use the <icon> XML element for URL’s targeting 1:1 images. Otherwise, use the <logo> XML element for URL’s targeting 2:1 images. Either element should be placed in the <feed> element:

<feed>
   <icon>http://domain.tld/path/icon.ico</icon>
   <logo>http://domain.tld/path/logo.gif</logo>
</feed>

Continue Reading

Feed Tester

Posted on December 4, 2006 in Perishable, WordPress by Jeff Starr

Ignore this post..

[Edit] Note to WP 2.0.5 users: Everything was working fine on this site before upgrading to WP 2.0.5. After upgrading, apparently, our feeds stopped validating* and the BDP RSS Aggregator plugin refused to update our own feeds. After several hours investigating the situation, we determined that the Live Comment Preview plugin was interfering with our feeds validating, while the upgraded WordPress (2.0.5) was responsible for problems with the BDP plugin.

Here is a copy of our recent comment posted at the BDP plugin website:

Comment by m0n on Wednesday 6 December 2006 at 4:28 am

I was running BDPRSS v.0.2.2 just fine before upgrading to WP 2.0.5. After the upgrade, I noticed that feeds from my own site are no longer updated. They are apparently polled, but reflect a ‘last updated’ value of the day I upgraded WP. I have, since the WP upgrade, posted several new articles that appear fine directly, through feedburner, etc.

I have tried just about everything (restoring old BDP databases, deleting and adding new feed entries in the admin panel, deleting cache, you name it, etc.). I have also tried upgrading to BDP 0.4.10, but to no avail. My own feeds will not update either in the BDP admin panel or on the web page itself. Adding different feed formats does not work either.

So, just a note to hopefully garner some more clues concerning this. I realize it may not be an emergency, because who reads their own feeds for crying out loud. Perhaps there are others out there with the same problem. If possible, try adding any of your own feeds (on WP 2.0.5) and see if they work. Well, thanks for listening!

The whole event pretty much zapped the weekend of any free-time, but the good news is that we managed to get everything working properly (according to our needs) once again — feeds all validate and we have previews of our own feeds via the BDP plugin — and we are still running WP 2.0.5! We’ll just bill the incident as another 8-hour "learning experience"..

If anyone is experiencing anything similar to the issues mentioned in this post, we would love to hear about it — drop us a line!

Update: [ May 28th, 2007 ] - Issue resolved! After moving the Perishable Press website to a new server, our WordPress feeds once again began updating directly through our own site (via BDP plugin, et al). Apparently, as our previous host continued to disable important PHP functions (as a solution to potential security vulnerabilities), the various plugins and scripts employing the disabled functions inevitably became useless. Thus, we attribute the source our non-updating feed issue directly to server limitations (and lazy technicians). While we cannot at this point discern exactly the cause of the problem, suffice it to say that our new host provides all the functionality needed for everything to run properly (and smoothly, we might add). So cheers to everyone who helped us with suggestions and ideas for this bizarre dilemma. We now enjoy fully functional and validating WordPress feeds. Case closed.

Footnotes

Add RSS Feed Link Icons to WordPress Category Listings

Posted on November 20, 2006 in WordPress by Jeff Starr

This brief tutorial explains two methods for adding RSS feed link icons to category listings. Let’s say that you have a list of category links, where each link targets a specific category view. Now let’s say that, next to each category link, you would like to provide a icon that links to that particular category’s syndicated feed. So, rather than cluttering up your page with two sets of category links — one for category views and another for category feeds — consolidate links and simplify your site by providing both sets of links in a logical, streamlined format.

Method One: A Static Category/Category-Feed List via wp_list_cats

Category Links via wp_list_cats
Category Links via "wp_list_cats"
The easiest way to create a set of category/category-feed links is to use the native WordPress function, wp_list_cats. This function creates a customizable set of static category links that may be used in or out of the WordPress loop.

Category links created this way are static in that the same categories are displayed for every type of page view. Thus, if configured to display categories "A", "B", and "C", the wp_list_cats function will create links for A, B, and C for post views, page views, archive views, category views, and every other view-type for that matter.

Nonetheless, despite this limitation, wp_list_cats provides an easy way to create a category feed icon links next their respective category links. Simply add the following to the location of your choice within your WP-powered document:

<?php wp_list_cats('feed_image=http://domain.com/path/feed-icon.gif&feed=XML Feed&optioncount=1&children=0'); ?>

In this code example, we are using the following parameters:

feed_image=http://domain.com/path/feed-icon.gif
This parameter creates the feed icon link next to each category link. Change the domain, path, and file name according to your particular setup.
feed=XML Feed
This parameter produces the requisite alt & title attributes for the specified feed icon (if any), and also produces title attributes for link anchor tags.
optioncount=1
This parameter indicates whether or not the function writes the category post count next to the link. "1" = yes, please display category post counts, "2" = no, please do not display post counts.
children=0
This parameter instructs the function to include or exclude subcategories in the set of category links. "1" = yes, please show all subcategories, "2" = no, please omit any subcategories from the category list.

This function also provides several handy parameters that are not discussed here. Please see the WordPress Codex1 for complete information concerning wp_list_cats.

Method Two: A Dynamic Category/Feed List via Category LiveBookmarks

A more sophisticated, comprehensive method of providing users with category/feed links is delivered via Monzilla Media’s essential plugin, Category LiveBookmarks Plus 2. Category LiveBookmarks Plus (CLB+) automatically produces a highly customizable set of dynamic category/feed links anywhere within your WP-powered blog. Plus, in addition to creating a custom set of feed links, CLB+ also creates contextually relevant LiveBookmark autodiscovery feed links to the head element of your document (see plugin page for more details). Here are a few examples of the different format options available via CLB+:

Category Link Set via CLB+
Left-aligned feed links
Category Link Set via CLB+
Text-based feed links
Category Link Set via CLB+
Right-aligned feed links

Of course, more configurations are possible, as well as many other customizable settings that enable users to create an ideal set of dynamically changing feed links throughout your site. Simply install the plugin and change the settings within the plugin file to customize your own set of category/feed links. Further, the CLB+ plugin creates a dynamic set of category/feed links that changes according to page view-type in order to provide only relevant feeds, as referenced via the particular page contents.

Regardless of which method you use, consolidating your category links with your category feed links will reduce clutter, streamline navigation, and promote simplicity. Thanks for listening — God Bless!

Footnotes

XHTML Document Header Resource

Posted on August 30, 2006 in Structure by Jeff Starr

This XHTML header tags resource is a work in progress, perpetually expanding and evolving as new information is obtained, explored, and integrated. Hopefully, you will find it useful in some way. Even better, perhaps you will share any complimentary or critical information concerning the contents of this article.

Table of Contents

Continue Reading

Category LiveBookmarks Plus

Posted on August 7, 2006 in WordPress by Jeff Starr

Category LiveBookmarks Icon
CLB+
New version of Category LiveBookmarks Plus now available! CLB+ 2.3.0b enables WordPress 2.3+ users to configure and customize the ultimate set of autodetection feeds, category feeds, category links, and feed links. Features include completely rewritten, optimized code, optional category post counts, and custom RSS-icon links for all category and/or feed links. Overall, the new version is faster and more flexible than ever!

Category LiveBookmarks Plus is the easy way to provide complete “Live Bookmark” functionality and "Post Smart" feed links to your WordPress-powered website. Simply install the plugin, and users with Firefox, Opera, Navigator, or any other modern browser, will enjoy a selection of your RSS feed links at their fingertips. CLB Plus seamlessly integrates the code necessary for modern browsers to automatically detect and update any RSS feed available from the current page, enabling readers to stay current with important news and updates.

Category LiveBookmarks Plus also makes it easy to add category feed links to posts, comments, pages, or anywhere else within your site. Simply add the <? clb_plus(); ?> function to the desired location within your blog, and there enjoy a contextually relevant selection of completely customizable RSS feed links. There are also options to include RSS feed links for “all posts” and “all comments”, as well as settings to customize markup, icons, and feed links. Plus, as of version 1.7.7, there are options to configure a custom set of category links next to corresponding feed links, which may include comment counts and RSS-icon links.

With CLB+, you may customize category feeds for the various WordPress view types (e.g., category views, page views). CLB automatically omits feeds with zero posts, and also excludes subcategory feeds. Further, this plugin produces strictly valid XHTML markup.

Installation and Usage:

  1. Unzip php file and add to wp-content/plugins directory.
  2. Open php file and adjust any of the "CLB OPTIONS", if desired.
  3. Add the following function call to your sidebar or any other location:
    <?php if (function_exists('clb_plus')) { clb_plus(); } ?>
  4. Feed links will be added to the <head> automatically. No further action required.
  5. Feed links will be added to the <body> wherever the function call (from step 3) is located.

Download Category LiveBookmarks [ version 2.3.0b | ~7.3KB | .zip | 3013 downloads ]

Related Information & Previous Versions

Category LiveBookmarks Plugin

Posted on May 29, 2006 in WordPress by Jeff Starr

UPDATE: New version of Category LiveBookmarks now available!

Already familiar with Firefox’s Live Bookmarks and WordPress RSS feeds? Well then skip the intro and jump to the good stuff »

Enthusiastic Firefox users enjoy the luxury of Live Bookmarks, a feature of Firefox that automatically discovers and updates RSS feeds. Web pages with available feeds are indicated by the orange feed icon located in the browser’s address bar. Clicking the feed icon presents a list of all available feeds for that particular webpage. Users then select which feeds they would like Firefox to bookmark, track, and automatically update. Very handy indeed.

Providing these Live Bookmark feeds to your readers is as easy as adding “link” tags for each feed to the head section of each webpage. Then, simply set the “type” attribute to application/atom+xml or application/rss+xml, and away you go. Not so bad, but a bit tedious, perhaps.

WordPress users typically transmit RSS feeds for both comments and posts, and frequently provide individual category feeds. Further, each feeds may be provided via a variety of formats, including RSS 0.92, RSS 2.0, and Atom. Manually adding the feed links to the header.php file works if you don’t care about context sensitivity, because the same links would appear for all pages, whether the feeds were actually available from there or not. Fortunately, there is a more sophisticated method for managing your Live Bookmark feeds…

Introducing Category LiveBookmarks, a WordPress plugin designed to simplify the process of adding complete Live Bookmark functionality to your website. Category LiveBookmarks (CLB) seamlessly generates “Live-Bookmark” feed links for each of your WordPress blog categories. It will generate feed links for all categories on your main blog page, and only relevant feeds on single-post-view pages. Also, CLB automatically omits feeds with zero posts, and excludes subcategory feeds. CLB is designed for Firefox’s Live Bookmarks and Opera’s Livemarks. Generates strictly valid XHTML markup. Tested and verified with WordPress 2.0+. Should work with WP 1.5+ as well (no guarantees).

This plugin has been adapted from ArunRocks plugin, Livemarks. Many important modifications have been made to the original, such as are summarized here.

Installation and Usage:

Unzip file, add to wp-content/plugins directory, upload, activate, and enjoy! There are also two options within the PHP file itself that you will probably want to customize: Comment feed links and blog title.

Download Category LiveBookmarks [ version 1.0.1 | ~4KB | .zip | 1924 downloads ]

UPDATE: New version of Category LiveBookmarks now available!

WordPress RDF Source Makeover

Posted on February 22, 2006 in Websites, WordPress by Jeff Starr

Beautiful Source-Code Output, Part 1: Whip your WordPress RDF Code into Submission

Update: This article applies specifically to WordPress 2.0.2, but may be generalized to any WP 2.0+ version.

I love looking at beautiful source-code output. However WordPress tends to spit code out in random chunks, often leaving spaces, line breaks, and tabs littered throughout the source output. This messes things up. Lists don’t look like lists and logically written code often appears scattered along the page carelessly. Often, this is the result of poorly written PHP, which can be manipulated to write beautifully aligned code that looks as good as it works.

For the first article in this series, we will bring order to the typical RDF chaos that WordPress spits out by default. To see an example of this, check out this source code, taken directly from the output of a default installation of WordPress. Notice how the awkward chunk of code leans, strangely enough, to the right. This type of RDF-code output seems to be the norm for WordPress users who have enabled that particular feature.

Okay, so it looks hideous, and we want to clean it up and make it shine. First thing to do is backup everything, even your database. Don’t trip though — this is a simple “cut-and-paste” procedure, but it is always a good idea to have a recent backup of your data just in case. Next, open the file wp-includes/comment-functions.php and find the function trackback_rdf, which is located about halfway down the page on line #525 (#509 for WP 2.0). Now, replace the following block of PHP code:

function trackback_rdf($timezone = 0) {
	global $id;
	if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
	echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
	    xmlns:dc="http://purl.org/dc/elements/1.1/"
	    xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
		<rdf:Description rdf:about="';
	the_permalink();
	echo '"'."\n";
	echo '    dc:identifier="';
	the_permalink();
	echo '"'."\n";
	echo '    dc:title="'.str_replace('--', '&#x2d;&#x2d;', wptexturize(strip_tags(get_the_title()))).'"'."\n";
	echo '    trackback:ping="'.trackback_url(0).'"'." />\n";
	echo '</rdf:RDF>';
	}
}

with our new and improved version1:

function trackback_rdf($timezone = 0) {
	global $id;
	if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
	echo '<rdf:RDF ';
	echo "\n";
	echo '   xmlns:dc="http://purl.org/dc/elements/1.1/" ';
	echo "\n";
	echo '   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ';
	echo "\n";
	echo '   xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">';
	echo "\n";
	echo '<rdf:Description ';
	echo "\n";
	echo '   dc:creator="';
	the_author();
	echo '" '."\n";
	echo '   dc:date="';
	the_date_xml();
	echo ' @ ';
	the_time('g:i a');
	echo '" '."\n";
	echo '   dc:title="'.str_replace('--', '&#x2d;&#x2d;', wptexturize(strip_tags(get_the_title()))).'" '."\n";
	echo '   rdf:about="';
	the_permalink();
	echo '" '."\n";
	echo '   dc:identifier="';
	the_permalink();
	echo '" '."\n";
	echo '   trackback:ping="'.trackback_url(0);
	echo '" '."\n";
	echo '   dc:description="';
	the_excerpt_rss();
	echo '" />'."\n";
	echo '</rdf:RDF>';
	}
}

Finally, open your WordPress theme’s “index.php” file, find the loop, and add an echoed line break to the commented-out RDF function. Your code should now look like this:

<!--
<?php trackback_rdf(); ?>
<?php echo "\n"; ?>
-->

That’s it — save the two files, upload them, refresh your pages, and check the RDF output in the source code. If all goes well, your RDF code should now resemble this:

<!--
<rdf:RDF 
   xmlns:dc="http://purl.org/dc/elements/1.1/" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description 
   dc:creator="Perishable" 
   dc:date="2006-02-22 @ 11:19 am" 
   dc:title="WordPress RDF Source Makeover" 
   rdf:about="http://perishablepress.com/press/?p=49" 
   dc:identifier="http://perishablepress.com/press/?p=49" 
   trackback:ping="http://perishablepress.com/press/wp-trackback.php?p=49" 
   dc:description="Beautiful Source-Code Output, Part 1: Whip your WordPress RDF Code into Submission
I love looking at beautiful source-code output. [...continued &#187;]" />
</rdf:RDF>
-->

Now that’s much better!

Next time we will look at constructing righteous headings and pimping them for excellence on planet source-code output.

Update: To gain greater control over your WordPress RDF source-code output, replace the native function, the_excerpt_rss(); (located near the last line of the trackback_rdf() function), with the more flexible function, the_content_rss. This function provides five parameters as described in the WordPress Codex:

<?php the_content_rss('more_link_text', strip_teaser, 'more_file', cut, encode_html); ?>

More specifically, here is how we use the function to limit the number of words output in the dc:description attribute, thus optimizing bandwidth while preventing unruly code examples from disrupting document structure (as in the case of JavaScript comments):

the_content_rss('', TRUE, '', 7, 2);

Fin

References