Journal

Textpattern 508 Links

15 May 2007 › 8 comments

One thing I love about W3C validator, for both HTML and CSS, is the keen ability to check incoming referrals, and validate against those pages. This makes creating and maintaining valid code a lot easier than if you had to manually type in every URL or hard-code the links into your pages.

This is something I have long felt was lacking from services such as the automated accessibility checker Cynthia Says. Usually, the best that we can do is have a 508 link which checks the root of our domain. This is all well and good, except that problems tend to creep up on interior pages more often than a home page. It’s easy to neglect the rest of a site.

Luckily, using some of the tag logic provided by Textpattern, we can create self-referential 508 links, so that each and every page on a site can easily be checked for accessibility compliance. Here is an example of the TXP code.

Template logic:

<a href="http://contentquality.com/mynewtester/cynthia.exe?Url1=http://example.com<txp:page_url />">508</a>

HTML output:

<a href="http://contentquality.com/mynewtester/cynthia.exe?Url1=http://example.com/">508</a>

<!-- or -->

<a href="http://contentquality.com/mynewtester/cynthia.exe?Url1=http://example.com/section/article-title">508</a>

Presupposing that your site is set up to follow /section/article-title URL structures, the above code will output a self-checking 508 link for the URL: http://example.com/section/ – except for when on the root of the site, in which case no section name is output.

Likewise, if the user is viewing an individual article, a 508 link to that particular page is provided. With those two angles covered, you’ve pretty much guaranteed that every page on your site will always be check-able, hopefully leading to more accessible code overall. Happy validating!

Discussion + Dissension

  1. #1 Michael Montgomery

    Excellent! Thanks, Nathan. That txp:section bit looked weird for a minute, since I'm so accustomed to using txp:s.

  2. #2 Nathan Smith

    Michael: The syntax txp:s is deprecated and will likely be phased out in future TXP versions. You should be using txp:section on all newer sites now. I just wanted you to be aware, for when you upgrade TXP on older sites.

  3. #3 Michael Montgomery

    Ah, thanks again.

  4. #4 Jon-Michael Deldin

    Regarding the TXP code, you could simplify with txp:else and drop if_individual_article. An even simpler version is:

    [a href=“http://contentquality.com/mynewtester/cynthia.exe?Url1=http://example.com[txp:page_url /]”]508[/a]

    (Pardon the brackets – Textile’s killing me today.)

    It’s not as modular, since you need to enter your domain address, but you don’t need conditionals.

  5. #5 Justin Thorp

    What about WCAG?

  6. #6 Nathan Smith

    Jon-Michael: Thanks for the suggestion. That is a much more efficient way of doing it. I have updated the article accordingly with txp:page_url.

    Justin: As far as I know, there aren’t any WCAG verification services that allow someone to create a self referential link from a site. That’s why I’ve focused specifically on 508 and Cynthia Says in this tutorial.

  7. #7 Jeff Adams

    Thanks for the tip Nathan. You could also use txp:site_url so you don’t have to hard-code the domain in there.

  8. #8 Nathan Smith

    Jeff: That’s true, except txp:site_url adds a trailing slash, and txp:page_url starts with a beginning slash. That leads to funky URLs, breaking the 508 link.

    http://example.com//section/article-title

    Note the double // after the dot-com.

Comments closed after 2 weeks.

FYI


Member of 9rulesSecure Hosting

Ads by Fusion

Latest Posts: All - RSS

My Book

Textpattern Solutions I had the privilege of co-writing Textpattern Solutions for the web technology publisher Friends of ED. If you want to develop a professional dynamic web site, without the hassle of writing all the server-side code from scratch, then Textpattern could be just the solution you are looking for.