How To Get Textpattern To Open Links In A New Window 24 January 2008
The old fashioned HTML solution used to be:<a href="http://www.example.com" target="_blank">open a new window</a>
NOT SO USER FRIENDLY
The whole point of Textile is to give authors a simple and elegant markup language to author web text. I’m sorry, but<txp:zem_prblock rel="external> ... <txp:zem_prblock>
wrapped around every external link does not strike me as particularly simple, elegant, or humane. By the way, I’d like to thank all of the people behind Textpattern and Textile. These products really are remarkable.
EXTRA PLUGIN TO INSTALL DURING THE SITE SETUP PROCESS
Plugins extend the functionality of the software. I think letting a user create their own contact forms, or manage their own email list are great reasons for writing plugins. Marking a link as external ought to be the province of core functionality in Textile, and it is… in a way.3 Besides, setup can be complicated already. I really like to keep things streamlined. If I’m going to add an extra step to an installation I’d like to be able to really get some good use out of the plugin. Installing the prblock plugin doesn’t really seem like it’s worth it.
I’d like to give my authors the ability to mark an external link by specifying so at the beginning of it’s title attribute or, in the case of an image link, it’s alt attribute.
TEXT LINK"Page on another site. (External Link: This article describes something or other)":http://www.example.com
IMAGE LINK – TEXTILE!http://www.example.com/blog/images/2.gif (External Link: Get Acrobat Reader.)! :http://www.adobe.com/products/acrobat/readstep2.html
IMAGE LINK – WITH TXP TAG<a href="http://www.example.com/products/foo.html" rel="external"><txp:image id="2" /></a>
This solution accomplishes the following:
- Ease of use for non technical Textpattern authors
- No use of deprecated markup (target=”_blank”)