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

Using plugins a little difficult

Started by Muut Archive 11 years ago · 6 replies · 351 views
11 years ago

hi, lately i try to use gmap plugin and read tutorial but could not run it properly. i could not find video tutorials to watch and practise it. i want to write an introdiction article about Grav in my site ( webritmi.com ) but there is some parts i could not solve yet.

11 years ago

I didn't write that plugin but form looking at it quickly here is some advice:

If you are wanting to use this in a markdown page, you will need to turn on twig processing because it's generated using a twig tag:

YAML
process:
  twig: true

After that you should be able to just use the Twig tag in your markdown:

TWIG
{{ gmaps({'address': '201 Wood Lane, White City, London W12 7TQ'}) }}

That should work :)

11 years ago

Yes it's true, sorry for reply only now, but my time is less then in the past... btw the example from @rhkster it's true!

11 years ago

hi, i don't know place where i put the twig tag. My sample is ..\grav-skeleton-blog-site\user\pages\01.blog\google-map. so should i put the twig tag into the item.md file under google-map folder or where to put it and what i write into item.md file to call the map?

11 years ago

No, the Twig tag goes in the template file you create to display the page, not the .md file containing its contents..

11 years ago

Actually that's not entirely true :)

It really depends on your needs. Grav lets you do both.

1) If you want your map to be in the middle of your content, you can put the twig tag in the middle of your markdown in your item.md file (just turn on twig processing in the header as I showed).

2) If the map is more a structural element of the page, it may make sense to create a new template specifically for this, say item-google-map.html.twig, that is basically a copy of item.html.twig that has this twig tag in it (no need to turn on twig processing here obviously)

If you go with the second approach and you are creating ore modifying theme 'things' you probably should do your own theme with the theme inheritance.

11 years ago

Dang! I did forget about allowing Twig processing in Markdown files. There may be some places I need that myself. :)

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1322 9 years ago
Archive · by Muut Archive, 9 years ago
2 917 9 years ago
Archive · by Muut Archive, 9 years ago
2 4048 9 years ago
Archive · by Muut Archive, 9 years ago
1 2922 9 years ago
Archive · by Muut Archive, 9 years ago
3 1106 9 years ago