I have a new requirement to integrate an existing pure static HTML page, with no dependencies, into my Grav blog. Ideally, I’d like a way have the static HTML page appear in the blog index page and in the proper category pages, just as if it had been prepared in the normal way as a Markdown blog post. Is there anyway to do that?
The static HTML page was auto-generated by another software tool. I’m looking for a straightforward way to integrate it into my existing Grav based blog, perhaps by prepending some “front matter” to the HTML file while putting into the Grav user/pages directory hierarchy.
Thanks
Try creating a template that is completely empty, maybe named blank.html.twig
. Now you can drop your static content into a markdown file (html works in a markdown file). Make sure the markdown file is named blank.md
and place it in your folder structure like any other page.
I have a similar use case, but I wanted a little bit of control so I drop html into the markdown files and use a template with just this:
<html>
<head>
<meta charset="UTF-8">
<title>{{ header.title|e('html') }}</title>
<link rel="canonical" href="{{ site.base_url }}{{ page.header.routes.canonical }}" />
</head>
<body>
{{ page.content }}
</body>
</html>
1 Like
Thanks, good suggestion. It made me think a bit about my use case and be a little less constrained in my search for a solution. I came up with this, which also seems to work well:
-
prepare a “container” post as usual, with header/frontmatter, and even containing “summary” info for the index
pages, but otherwise without content.
-
in the front matter use the new “redirect” header to go the static HTML page located in the same directory as the post.
Again, thanks for the thought provoking suggestion and the quick response.