How to apply the layouts/_default/baseof.html to ExecuteAsTemplate?

Hi, I want to create some HTML pages for users via ExecuteAsTemplate automatically, so that users do not need to create those pages. Is it possible to apply layouts/_default/baseof.html for those pages? Or is there a way to reuse the layouts/_default/baseof.html?

  1. I’ve defined a template under assets folder.
  2. And then ExecuteAsTemplate that template.
  3. I want to render the template with layouts/_default/baseof.html and others partials, but those layouts and partials require the Page variables, this is the hardest problem for me, it there a way create a cutom page at build stage, and then pass it to ExecuteAsTemplate?

Here’s an example of creating pages from data:

git clone --single-branch -b hugo-forum-topic-36112 hugo-forum-topic-36112
cd hugo-forum-topic-36112
hugo server

This approach uses the resources.FromString method.

1 Like

:+1: Thanks, I’ll take a close look at your example.

A post was split to a new topic: Can I pass function to partial?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.