CrowCpp / Crow

A Fast and Easy to use microframework for the web.
https://crowcpp.org
Other
2.96k stars 335 forks source link

How to use mustache Sections? #734

Open rsousacode opened 6 months ago

rsousacode commented 6 months ago

I would like to re-use html templates like the header. Is it possible to do with Crow?

Here they talk about those sections https://jgonggrijp.gitlab.io/wontache/mustache.5.html

I tried this but it renders the string, and doesn't go into html

  auto header = crow::mustache::load_text("header.html");
  ctx["header"] = header;

  auto page = crow::mustache::load("index.html");
  return crow::response(200, page.render(ctx));
mrozigor commented 5 months ago

My site is old, but maybe it will be helpful -> https://github.com/mrozigor/mrozigor.net/blob/master/src/controllers/MainController.cpp