Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{{ theme }} tag 'absolute' attribute doesn't appear to work #2342

Closed
simonhamp opened this issue Jan 28, 2019 · 2 comments

Comments

Projects
None yet
4 participants
@simonhamp
Copy link

commented Jan 28, 2019

Describe the bug
I'm overriding the reset password email template in my theme and am trying to use a reference to a theme file (e.g. the logo) by using the following, assuming that this will interpret an absolute URI into the <img> tag.

<img src="{{ theme:images src="logo.png" absolute="true" }}">

However, the URL in the compiled view contains only a relative URI.

I see this in statamic/bundles/Theme/ThemeTags.php:198:

if (! $this->getBool('absolute')) {
    $url = URL::makeRelative($url);
}

But the URL is already relative.

Expected behavior
An absolute URI.

Environment details (please complete the following information):

  • Statamic Version: 2.11.9
  • Upgrade
  • OS: macOS 10.14.2
  • Web Server: Valet
  • PHP Version: 7.3

Additional notes
I can fix it by patching it with the following code (haven't checked if this side-effects anything else yet):

if ($this->getBool('absolute')) {
    $url = URL::makeAbsolute($url);
} else {
    $url = URL::makeRelative($url);
}
@hmalaud

This comment has been minimized.

Copy link

commented Jul 10, 2019

Sorry to comment on a closed issue, but it seems to have broken relative paths: now {{ theme:asset }} always outputs the absolute path (https://.../site/themes/{theme}), and forcing the parameter absolute="false" does not seem to work either.

@EnricoSottile

This comment has been minimized.

Copy link

commented Jul 15, 2019

I have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.