Wrapping basic static HTML page in sites base template. How to?

21 views
Skip to first unread message

Bernd Wechner

unread,
Oct 16, 2017, 7:07:56 AM10/16/17
to django...@googlegroups.com

Curious and I admit lazy question as I don't even know where to look or how for such a general idea. But there it is, I'd like to be able to write a static HTML file (like say about.html) and render that inside of the sites style and basic template.

So I have base.html for example, which contains say:

    {% block content %}{% endblock %}

and various views that start with:

    {% extends "myapp/base.html" %}

and define content blocks.

I'd like a simple filter perhaps (or tag) which loads a nominated static html file but has some rudimentary smarts in its rendering. For example using the h1 text as a page title, and inserting a table of contents of ann the h2 and other headers with links to the respective sections. The static HTML file then need only declare the headers and texts and the template filter/tag would weave it together in such a manner.

Is that a common sort of need, that;s been solved, and done? Just curious really. Seems a common need at my end ;-). Hence a classic application of the DRY principle, and generalizing the routine elements of Table of Contents building and linking.

Regards,

Bernd.

Thiago Luiz Parolin

unread,
Oct 16, 2017, 7:32:31 AM10/16/17
to django...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/22b3f568-d045-6d56-a31b-944e7cc7ac79%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages