One frustrating part of the WCMS templating system is that while an anchor can output two (or more) pieces of information (title and url), you must choose either to use the basic tag markup (standard <a> tag) or use the path and file name only option of the anchor. This presents challenges when you want both the url and page title, but want to add additional markup. This issue really comes into play with breadcrumbs and lists.
I recently wanted to change our base templates to have breadcrumbs that conformed to Google’s rich snippet standards. This requires a change in the markup generated by the anchor placeholder. After trying multiple different approaches, I finally found a workable solution using pre-execution.
Step 1 – Use techniques previously posted to get the full anchor tag into a pre-execute variable
While looping through the breadcrumb, I create an anonymous function which has a body of only a comment followed by the anchor tag placeholder. I can use the “toString()” method to get the whole function tag as a string and use a regular expression to extract only the original placeholder.
Step 2 – Parse the anchor tag and add the necessary attributes and tags
Step 3 – Use VBScript to output the result
- Improving website security - August 31, 2017
- Web Press to be upgraded June 7-8 - June 1, 2017
- Free workshop: Become a security ninja - May 18, 2017
- Do your part for web accessibility - March 2, 2017
- Our picks from #heweb16 - February 2, 2017
- Missouri State seeks full-time new media specialist - January 31, 2017
- Better search results now available - August 18, 2016
- Missouri State seeks full stack developer/engineer - June 24, 2016
- Missouri State seeks full-time new media specialist for alumni relations - June 20, 2016
- Calendar is now mobile friendly - June 2, 2016