Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

jinja template stuff in a page #1

wants to merge 1 commit into


None yet
5 participants

dAnjou commented Sep 14, 2011


I noticed that jinja stuff doesn't get rendered in a page. So I fixed that really quick and maybe dirty. Have a look please and let me now if that could crash something. As far as I saw it doesn't.




SimonSapin commented Sep 15, 2011

Hi dAnjou,

I never thought of pages containing templates. I just use Markdown + some inline HTML.

What’s your use case for this?

dAnjou commented Sep 15, 2011

I use url_for() for images in /static. But flashed messages would be possible too.

naringas commented Nov 3, 2012

Couldn't you set the FLATPAGES_HTML_RENDERER option to a function such as:

def my_renderer(text):
    prerendered_body = flask.render_template_string(flask.Markup(text))
    return pygmented_markdown(prerendered_body)

@SimonSapin Use case is exactly this: include stuff like images within the Markdown, link to other pages .. all with url_for.
@naringas this works, but it would nevertheless be nicer to have it in Flask-Pages .. and active by default. That's what at least I expected would work anyway. It didn't, so I had to Google it, and do as above. 15mins effort, so not a big deal.


SimonSapin commented Nov 16, 2013

I’m not using or maintaining Flask-FlatPages anymore. Deferring to @playpauseandstop

Alright. Thanks for the notice!


playpauseandstop commented Nov 28, 2013

I'm not sure what we need to change in Flask-FlatPages to have this ability, add new renderer function to repo and point out in docs, that we have one to render flat pages with jinja stuff? Is this enough?

My personal view is: rendering embedded Jinja directives should be the default - not requiring the user to do anything special.

That would mean including the render_template_string within Flash-FlatPages at the right location.

And if this is not acceptable: clearly point out how to add Jinja directives rendering in the docs (the method of @naringas works).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment