I had this running.
But all of a sudden it sopped.
The main thing i have done between running an stopping was clearing cache, import some JS in base.html.twig an use it in som jquery function jQuery(document).ready
also i realized that it seems to render html tags not well . as this code is shown on my page now.
For security reasons, the latest Grav 1.7 RC is more tight about the output of HTML, Javascript etc. in Twig. Output is now escaped by default and output tags {{ }} in Twig need the |raw filter to insert un-escaped code.
Note: This |raw filter should only be used when the code to be outputted can be trusted. E.g. when it is not derived from user input.
@anon76427325 thank you very much for your qick response. I also subscribed to the github issue.
I did the suggested changes. But still its not showing the carousel. At least the rendered code on the page seems to look good again without character issues.
Added filter |raw to /user/plugins/shortcode-owl-carousel/templates/partials/owl-carousel.html.twig:
{{ owl_items|regex_replace('(^\n?<p>|<\/p>$)','') | raw }}
Cleared cache: $ bin/grav cache
Refreshed browser and all looks wellâŚ
Btw. I presume that the 3 dots in <img src="/user/pages/.../Dashboard_1.png"> is not in your markdown and resulting code, but is used to shorten the line in the example. Right?
@bosse, It wasnât really clear from your question that you were using the shortcode in Twig⌠Or did I overlook something?
To make the script compatible with 1.7, you will have to again add the |raw filter:
{{ carousel | shortcodes | raw }}
There is an issue when using shortcode from Twig. Shortcode Core plugin doesnât add the required assets (stylesheets and javascripts and inline js). See Assets not loaded when using shortcode only in Twig
Did you add these manually to the template in your previously working version?
UPDATE: This issue does not occur when using shortcodes in the Twig of a child module of a modular page.
If i havenât made the shortcode in twig usage clear enough i am sorry. Anyways i am very happy about the solution. And this way we have worked out the solution for both styles.
in my previous version i added the carousel in the exact same way except the two â|rawâ inserts. (will keep an eye on that issue as well)
@bosse, Not sure how you fixed the issue that assets are not being loaded into the page. I cannot get Owl Carousel to work without manually copying the assetsâŚ
Would you mind explaining how you solved that issue?
NB. Please mark the the post as solved by ticking the âsolutionâ icon in any reply. And while you are at it, hitting the love/like icon as a token of appreciation wouldnât hurt eitherâŚ
@bosse, Thanks for the elaborate script. I appreciate it, but thatâs not quite what I meantâŚ
As said before, when the Owl Carousel shortcode is only used in Twig, the assets required to show/run the carousel are not added to the page. The following assets are missing:
I definatly removed all shortcode from *.md (which is a modular in my case). Whereas it has been input for testting beforehand. Do you think this might have make the import of *.css and *.js assets persistent?
I do nowhere explicitly import the named assets to my html (at least not being aware of at all)
Owl Carousel version: 1.0.3
and i can tell from reviewing my website code on load that all named assets are loaded without difficulties.