Rory's Blog
Home
Blog
Projects
Facebook
Google+
Github
RSS

Site: Tornado Browse Bar

09/10/14

So, that browse bar to the left (or wherever it may be in the future) is copy-pasted to every html link that exists within this site.

That's bad. I have... around 100 files now that make up this site (that'll need to change, too, but one thing at a time). If I wanted to change that bar in most any way, I'd have to make that change to all those files. I'd probably make a script that would do that, but still, smarter to have that browse bar html in one place and have everything that wants it grab it with a single bit of markup.

So, how should I do that with Tornado?

Enter Tornado's template documentation.

Reading....

Reading....

Okay, I think I get it. Really, I can copy one of my many browse bar copies into a browse_bar.html that's placed in my template area. Any bit of code that wants it can just:

{% include browse_bar.html %}

Let's make a little test of this with my tornado Github repo.

Done.

And here it is in action.

Don't be concerned if you think it looks exactly like the regular homepage. That's what it's supposed to look like. I'm refactoring the site before I further improve it.