Old content warning banner and Google Analytics

Today Kenny asked for a couple of things. Since the replacement for www.inf.ed.ac.uk/student-services went live yesterday (web.inf.ed.ac.uk) he wants the old pages to have some sort of “Old content” warning and a link to the new site, until such time that we simply redirect old to new content. One snag is that not all the old content has moved, as we can’t support restricted pages on EdWeb yet, so they need to remain in Plone.

The correct way to do this, would be some clever Plone/Zope hacking, which some how decides to display the “Old content” warning or not. But I don’t know how to just do that, and I don’t think I should spend the time finding out, only for it to become redundant anyway. My hacky-ish solution is to update the Plone main template (which I’ve done for other tasks) – https://www.inf.ed.ac.uk/student-services/portal_skins/custom/main_template – and add the “Old content” text so that all pages get the warning. For those individual pages and sections (there’s about 6 in total), I’m going to then remove that markup via Apache filters https://httpd.apache.org/docs/2.2/mod/mod_ext_filter.html . Hopefully with little more than a sed script. I might actually just set the CSS to “display: none”, we’ll see.

The other thing Kenny spotted was that by default the standalone EdWeb distro doesn’t include the University Google Analytics code (which our existing Plone pages have). So the quickest way to add that was to add a new block to the footer, with the required javascript. We also needed to add a new Drupal Text Format to allow us to enter the raw markup, as all the default UoE Text Formats strip the necessary tags. We set it so that only “system administrators” can use this Text Format to hopefully avoid any unexpected problems.

As I write this, the GA stuff is up and running, but I’m still working on the Plone “Old Content” warning. I’ve updated the template with an empty bit of markup just now, so I can test the removal bit.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.