21 October 2003

Printer friendly feature is required for Coret Moret, because it gives visitors a better page without to be spoiled by some Web pages attributes such as browser-minded layout. It is about stripping unnecessary HTML tags from page and remove layout block. I think this is one advantage of using DIV so removing block is well represented logically inside the document format.

To provide printer friendly pages in MT, I do these following steps:

  1. Create new template for printer friendly. I choose Individual template to be stripped. Remove block layout, comments, and other unnecessary header tags.
  2. Because printed version is attached into individual article, so inside Template section, create Archive-related Templates and use informative name, for example Printer Friendly for my template.
  3. Now, to use that template, in Weblog Config, section Archiving, create new archiving with Add New... button and choose Individual archive type for inserting new template.
  4. Back to Archiving page, create new archive name, in Archive File Template. To distinguish with existing Individual Entry Archive, I add _pf suffix. Because I use my own file name for Individual Entry Archive, so I make it both of them correlate. As the result, file perbaikan_komentar for example, will have printer friendly version namely perbaikan_komentar_pf in the same subdirectory.
  5. Add related URI inside any template that expose printer friendly version. For example, in the bottom of article in individual mode I insert <a href="<$MTEntryPermalink$>_pf">Printer Friendly</a>.

In short, we create a new "stripped" template and make them related in the final document. Another approach I ever read is by using mt-view.cgi that is provided by MT. This approach using dynamic view by manipulating document from database directly per request.

The bad side about my trick is: I can not prevent search engines' robots crawling these printer friendly pages, because it resides in the same directory with the original archive files. I try to save all printer friendly document in other directory with similiar structure and then protect that directory using robots.txt but I can not find any tags for to represent this alternative template. So, the final thing I can use for preventing search engines' indexing is using META tag. I know it is not good idea because the document is still fethced. Any idea?

Added on 1 Nov: In Warnadunia Forum Nimbus suggested using CSS 2's Media Type capability to handle this situation. Nice alternative.

No comments: