Conditional content on static pages

33 views
Skip to first unread message

Jonathan Sibley

unread,
Jul 7, 2012, 11:24:04 PM7/7/12
to blogofil...@googlegroups.com

Hi all,


I'm new to Blogofile, and I'm working off the simple version of the example to build my own site.  I'd like to be able to put something at the top of my website that only appears on certain pages.  For example, I'd like it to appear on the static page defined by index.html.mako, but not on another static page called about.html.mako.  Is it possible to call a function topContent() in _templates/site.mako, but have the definition of that function reside in about.html.mako and index.html.mako?  Then I would be able to define topContent() differently for whichever page is being displayed.  I've tried calling next.topContent() in site.mako, but perhaps one problem is that I don't understand inheritance very well in Mako yet :)


I'd really appreciate any help anyone might be able to offer!


Thanks,

Jonathan

Doug Latornell

unread,
Jul 8, 2012, 10:05:48 AM7/8/12
to blogofil...@googlegroups.com

I think that what you're trying to do is just a matter of getting the Mako inheritance sorted out. If you are using blogofile 0.8.dev from github, you may be having problems getting it to work because of the "template use order" bug that Ravi and I are working on [1]. Try working things out in a minimal example using Mako directly in the Python interpreter or a small script.

[1] https://groups.google.com/forum/#!msg/blogofile-discuss/mUWTkXUvjGo/DvOhaPkicKoJ

Things are going a little slowly on my end of the template order bug because I have family from afar visiting and perfect summer weather has suddenly arrived here in Vancouver...

Doug
Reply all
Reply to author
Forward
0 new messages