How to add custom html in head only on particular page

I want to add Schema Tags for each page like FAQPAGE and QAPage Tags and others so I want to add some content to head but only on that page, I searched everywhere no plugin or method available.

In your page template you could have something like

{% extends 'partials/base.html.twig' %}

{% block head %}
    {{ parent() }}
    <any custom="tag" />
{% endblock %}

Where to add this bit of code?? I am super sorry for such a bad question but I am beginner so I don’t know :sweat_smile:

What steps did you take to achieve your goal? Are you familiar with templates? If not, did you read the docs? When you have understanding how page templates in Grav work, then you might provide us with more information needed, because now (at least) I have no answer without knowing anything about your page structure.

1 Like

I got a solution myself after 24 hours hard work and reading docs, So If someone is also trying to achieve the same then here is the step by step solution:

Configuration :

  1. Open this file in editor user\themes\themename\templates\partials\base.html.twig
  2. Add this a bit of code before ending head tag {{ header.customhtml|raw }}

Usage :

  1. If you are using admin plugin then simple select Expert Mode in page and you will see a title : ’ title here’ this type of text all you need to do is leave one line and enter your custom html like below line!
    customhtml : '<anything in html you want></aihyw>'

Now If you want you can go back to normal and save page and see the page source you will see that you are successful.

  1. If you are not using admin panel then all you need to do is add this line in the markdown file in the column where the title is present.
    customhtml : '<anything in html you want></aihyw>'

If you are using one of the installed themes from GPM, you will loose {{ header.customhtml|raw }} part on update. You should either extend a theme or have your own.

Yes I am using my custom theme!