nationalarchives / tna-child-about-us-research

TNA Child theme for the used for the open access repository
0 stars 1 forks source link

Sort out the breadcrumbs #2

Closed grange85 closed 8 years ago

grange85 commented 8 years ago

The generated breadcrumbs need to have the complete and correct path

grange85 commented 8 years ago

I'm going to extend this to "all external links" - I was thinking something along these lines - but happy to have other ideas...

untested semi-pseudo code alert!!

define ("SITE_BASE_URL", "/about/our-role/");
function fix_internal_url($url) {
    $pattern = "/http:\/\/(.*?)\.gov.uk/(.*?)/";
    $replace = SITE_BASE_URL . '$2';
    return preg_replace($pattern, $replace, $url);
}

And then by default hit this function for all internal links - the function could exist in tna (and tna-base) with SITE_BASE_URL defined as "/"?

There obv may be ab easier/safer way so happy to go with that.

The fake code pattern above assumes a full url - so will need to be adapted for other urls (and possibly some conditions so it only runs on appropriate urls...

Thouhts @domingobishop @punalsc @matt-blair @sdwilkes ... ?

grange85 commented 8 years ago

Short term fix has been implemented

Still required: