After updating to 1.4 (Although It could be a change in another plugin since this site was ~6m old and I did a bulk update to everything) … I get " Twig_Error_Syntax - Unexpected character “&” …" in the following markdown where I concat the string (~) in the twig. If I remove the tilde ~ it passes over to the next time I’ve done this.
It looks fine to me. It’s a strange error I haven’t seen myself.
What is the value of home_url? What happens when you substitute home_url for a literal string e.g. “/siteroot”.
A couple of (unsatisfying) workarounds:
({{ home_url }}/gallery) should provide the same result
do you have a good reason to think the home URL will not be the server root? Unless you do, simply hardcoding [Gallery](/gallery) will be fine, no need to involve Twig
Might might have to set twig_first: true in config, but I would prefer either of hughbris’ workarounds, especially the latter one. If you are just referring to domain.tld/gallery, you want to use native methods like /, ./ or ../ to determine paths.
Thanks for the feedback. I have used your suggestions to work around the issue, but I have also been able to reproduce the problem in a clean install of v1.4.1.
In the MD file with process: twig: true…
This {{home_url}} or {{home_url}}/blah or even {{home_url ~ "\blah"}} work as expected.
However if I put the twig in a link it fails.
On my devel setup (WinOS, WAMP) installed under /grav14 I get these results:
It does seem like a bug in parsing and quite possibly in Grav, so please log an issue with instructions to reproduce if you can. Could you try [home_url-tilde-blah]({{(home_url ~ "/blah")}}) (extra parentheses inside Twig)?, though even if that works, I think there’s a bug here.