# When will canonifyURL be removed from hugoThemes build script?

**URL:** <https://discourse.gohugo.io/t/when-will-canonifyurl-be-removed-from-hugothemes-build-script/13824>\
**Category:** support\
**Created:** [August 25, 2018, 3:22pm UTC](https://discourse.gohugo.io/t/when-will-canonifyurl-be-removed-from-hugothemes-build-script/13824 "2018-08-25T15:22:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![it-gro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/it-gro/32/4767_2.png) [@it-gro](https://discourse.gohugo.io/u/it-gro)\
**Post date:** [August 25, 2018, 3:22pm UTC](https://discourse.gohugo.io/t/when-will-canonifyurl-be-removed-from-hugothemes-build-script/13824/1 "2018-08-25T15:22:49Z")

</div>

canonifyURL is getting [removed](https://github.com/gohugoio/hugo/issues/4733) (probably) from hugo  
and is currently giving trouble (e.g. with resources):

> <https://github.com/gohugoio/hugo/issues/4998#issuecomment-410511645>

The [generateThemeSite.sh](https://github.com/gohugoio/hugoThemes/blob/master/_script/generateThemeSite.sh) uses

```bash
export HUGO_CANONIFYURLS=true

```

Up to Hugo V 0.42.2 this worked for my theme

```auto
<img
  src='{{ $myImage.Permalink }}'

```

where $myImage is a processed image (e.g. $myResource.Resize “300x”)

But starting with hugo V 0.43.0 this no longer works - if canonifyURL is used and `Site.BaseURL` is something like [http://example.com/foo/bar/](http://example.com/foo/bar/)  
There is no issue without canonifyURL.

So if the plan is to drop the canonifyURL support anyway - when will the forced usage of canonifyURL for [hugoThemes](https://github.com/gohugoio/hugoThemes) be removed?

As a workaround I currently use:

```auto
<img
  src='{{.Site.BaseURL}}/{{ $myImage.RelPermalink }}'

```

---

<div class="post-metadata">

**Author:** ![it-gro](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/it-gro/32/4767_2.png) [@it-gro](https://discourse.gohugo.io/u/it-gro)\
**Post date:** [August 26, 2018, 9:40am UTC](https://discourse.gohugo.io/t/when-will-canonifyurl-be-removed-from-hugothemes-build-script/13824/2 "2018-08-26T09:40:02Z")

</div>

> [@it-gro](#):
>
> As a workaround I currently use:

Turns out, that did not the trick.  
I’m currently using

```auto
{{- $myBaseUrlSubDirs := replaceRE `^(http(s)?)?://(.*?)/` `` .Site.BaseURL }}
{{- if not (findRE (printf "^/%s" $myBaseUrlSubDirs) $myImage.RelPermalink) }}
 {{- .Scratch.Set `myImagePermalinkWorkaround` (replaceRE `^/` `` $myImage.RelPermalink ) }}
{{- end }}

{{- $myImagePermalinkWorkaround := (.Scratch.Get `myImagePermalinkWorkaround`) | default $myImage.RelPermalink }}

<img
  src='{{ $myImagePermalinkWorkaround | absURL }}'

```

so removing the leading `/` - if `BaseURL` defines subdirs  
Looks like this works whether `canonifyURL` is given (as for the [hugoTheme](https://themes.gohugo.io/) site) or not.  
(Tested with this [repo](https://github.com/it-gro/testing-hugo-42_to_43-changed-resource-permalink))
