Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

How can I 'include' a static outside of the templates directory?

Started by Muut Archive 10 years ago · 1 replies · 450 views
10 years ago

Hi all, thanks in advance for any help!

I'm looking to include some svgs using Twig include

TWIG
{% include '../statics/svg/whatever.svg.twig %} 

but it appears that you can't navigate back directories in Twig

From the research I've done it seems like the only solution would be to define a seperate base path but I really don't want to mess with grav core.

There must be another way around this - any suggestions? :)

10 years ago

Twig's include directive is for processing other template files. Do you actually want to process your SVG file with Twig? If so, store it with the rest of the templates. Why store them separately from the rest of the theme's media? If you're just trying to use SVG images in your site, use raw HTML in templates or Markdown in page files. See the Media page and url() docs for more info.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1350 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4061 9 years ago
Archive · by Muut Archive, 9 years ago
1 2948 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago