Show some kind of dynamic content

I evaluate at the moment grav, whether I can use it for my specific case or not.

My requirement is the following:
I have generated documentation html files with doxygen. These files contain HTML.
Now when a user calls:
I need to load the file called “classes.html” and embed it’s content into my base website template.

Is this possible with grav, when yes, how?

try to see the “page-inject plugin”, which includes a grav page within another page, I think you can easly modify it to include your html page.

The thing is, I have to load the file content of the html page depending on the provided URL.
E.g.: I have to load 'doc/api-1-0-0/classes.html’
On this page I have other links, which then have to load on request.

Can I do this with grav?

You can do anything :slight_smile: But it might be a little work.

2 options off the top of my head:

  1. Ensure your Grav page structure mimics the HTML structure, and going to any .html page will automatically just work for a Grav page.

  2. If you have a custom Grav page structure, you would probably need to write a custom plugin with some regex to search replace the URLs into your custom Grav structure.

I don’t know what you mean with page structure of grav.

I think 1) cannot work, because I want to embed the content of the HTML file into my website. e.g.

%HTML content%

I think it can be only done via a plugin, but I have to be able to retrieve the URL and depending on the URL I load a file and it render it into the page.

Well i would suggest having those files locally somewhere, rather than remotely… it would be quite slow to get a remote file for every page. Like I said, a plugin might be needed but all it would have to do is load the .html file and inject that in the page. Easy enough in Grav.

Regarding page structure, read the docs on folders for more info.

What do you mean with remote? The files will be of course located on the same server somewhere in the page structure of grav (maybe under 03.doc/version-1-2-3/).
We are speaking of maybe 200 HTML files. These will be placed under one folder, e.g. “version-1-2-3”

Here is an example:

Then speed shouldn’t be a huge issue. I think i’ve provided enough information to get you started. It should be 100% possible. Short of actually doing all the work for you and testing it, the rest is on your shoulders :slight_smile: Good luck!

Can you give me a hint, which hook I have to implement and how I get the current URL to load the file content?

I have looked into this plugin:
The event you have overwritten:

public function onPageContentRaw(Event $event)

does not contain the current URL.

Reading this thread, it appears that Grav won’t do this “as is” and is going to take a certain level of customization to get it done. Plug-ins are not real hard, if you have some PHP development experience - at least a little. Do you?

My first approach was, using the file-content plugin, and forwarding the URL to the plugin.
However, Grav try’s to load immediately the file, which is of course not an md file…
Here is my folder structure:


How to load the myHTML.html file and embed its raw content in the rendered grav page of ‘’?
So I get my main navigation menu and below the file content of myHTML.html.

The user URL to enter this page would be:

Which file does Grav load immediately? For a user going to, Grav will use the file to open and render the template named default.html.twig.

when I load this URL: grav will load the error.html.twig

Which is of course not what I want.

If you point your browser to, Grav will use the Markdown file it finds there ( as the page and render it with the template default.html.twig.

So the code to include myHTML.html needs to be in the template. Don’t navigate directly to the HTML file.

but this is the requirement, the URL has to be
Within the loaded html, there are of course more links, which then has to be loaded too.

I don’t know how to do that. I suppose custom code could be written to change the way Grav routes pages. At least the way I understand that Grav routes pages.