Render without parent component? #18
Replies: 3 comments 5 replies
-
Hi! 👋 Answering your second question: JinjaX can definitely be used to render only a section of a page. To do so, you call Let me elaborate.
a) and then make the call from inside the traditional template. For example: b) Do the same in your view and pass the resulting HTML as a variable to standard template: def my_view():
...
footer = catalog.render('Footer')
return render('my_page.html', footer=footer, **more_context) Note that the standard templates doesn't even need to be Jinja-based |
Beta Was this translation helpful? Give feedback.
-
Almost forgot: you also need to insert the CSS and JS urls of the components in the template that render the
<html>
<head>
...
{{ catalog.render_assets() }}}
</head>
<body>
{% block 'body' %}{% endblock %}
</body>
</html> AFAIK Jinja renders the "child" templates first and then the wrapper component, so even if you use the (a) option, at that point the catalog will have a list of all the asets... but if not, the (b) option will work for sure |
Beta Was this translation helpful? Give feedback.
-
About your first question... it can present a few challenges.... and I know because I've tried: JinjaX documentation it's actually rendered with a very alpha-stage/experimental system like that: https://github.com/jpsca/ClayDocs The trickiest one is dealing with source code in the markdown: you need to wrap any embedded code in the markdown with The `<Button>` components are awesome! will either fail because of a lack of To deal with that I render the markdown first, and then replacing each catalog.render("RandomName", __source="...source of the page here...'")` |
Beta Was this translation helpful? Give feedback.
-
Hi! 👋 I think jinjax is something I've been looking for for a very long time. Now as I'm learning how to start with it, I figured out the starting point of rendering is that I tell the catalogue which top-level component I wish to render. But what if there's no top-level component? 🤔 My use cases would be:
on_page_markdown
hook), but I cannot give it a top-level component (perhaps I can, but it wouldn't be practical).template.render(**context)
to be able to go through the Jinja code and process it as always, but also be able to process a component if it's present inside a normal Jinja code.Is something like that possible, or are we talking about mutually exclusive worlds? Is it either all jinjax or nothing?
Beta Was this translation helpful? Give feedback.
All reactions