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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Best place to add site-wide chat widget?

Started by Muut Archive 12 years ago · 4 replies · 258 views
12 years ago

Total Grav newbie here, but loving the CMS as I learn more and more about it. Can't wait until the Admin control panel plug-in :-)

I am exploring adding a chat widget to my Grav site, and the widget instructions state "...Copy the following script and insert it into your website's HTML source code between the <head> tags.
This code must be inserted into every page".

Would there be any best practice about how this is best done with Grav?

Thanks very much,
Paul

12 years ago

Couple of options:

1) Add it directly into the templates/base.html.twig of your theme. See the blog post about extending base theme if you plan on doing this.

2) Create as simple plugin to add your JS/CSS dynamically to Grav via the assets object. Look at anchors plugin as a good example of how to do this. It only takes a simple plugin to do, and then can be easily published/released and used by others.

Preferred approach is #2 :)

12 years ago

Thanks very much. I've been able to do #1, but with the minor change that the base.html.twig file for the Antimatter theme I updated was at templates/partials/base.html.twig

Works like a charm! Very clear instructions with the Theme inheritance post as well.

Thanks,
Paul

12 years ago

Ah yes, that missing partials dir was a typo on my part.

12 years ago

No problem, I really appreciate the help!

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1282 9 years ago
Archive · by Muut Archive, 9 years ago
2 889 9 years ago
Archive · by Muut Archive, 9 years ago
2 4019 9 years ago
Archive · by Muut Archive, 9 years ago
1 2894 9 years ago
Archive · by Muut Archive, 9 years ago
3 1078 9 years ago