Adding a custom class to navigation links?

21 views
Skip to first unread message

BenC

unread,
Mar 18, 2010, 3:48:03 PM3/18/10
to Bonsai
Hi, I'm new to Bonsai, and loving it so far. Watched your video and
checked out the code on github, and now I've got some questions. Is it
possible to add a custom class to the auto-generated navigation links?
More generally, if I want to write helper functions, what would be the
best way to go about that without getting in the way of future
updates?

I'm converting a jekyll site (that really isn't a blog) over to Bonsai
now, and I really like the decisions you made in creating it. Plus, as
a first time mustache user, I'm quite pleased with the templating.

Ben Schwarz

unread,
Mar 18, 2010, 4:56:18 PM3/18/10
to Bonsai
HI Ben,

Can you be more detailed about the classes that you'd want on your
elements?
What output do you want exactly?

The more ruby (rails) people who use it, the more I hear about helpers
and extending the environment.
I've been thinking about planning something for a little while now,
but I haven't gotten around to it because I personally simply don't
need anything like that.

Basically, in terms of implementation, I reckon if you added an
"extensions" folder with some ruby files in there, I'd plan on
requiring those if they exist. So if you want to have a stab at it
I'll be happy to checkout any commits you make and either make comment
or merge them if they're spot on the money :)

Don't forget that you don't HAVE to use mustache, although it is the
only templating language in tilt that has support for partials out of
the box.


Happy planting.

BenC

unread,
Mar 18, 2010, 6:09:51 PM3/18/10
to Bonsai
As soon as I posted, I knew the answer. I was trying to get something
like this:

<li><a href="/varieties/" class="varieties">Varieties</a></li>

Which I got quite easily with {{slug}}. So... I just feel foolish. A
lingering question though: how would I add an "active" class to the
currently active page in the navigation links? I'll put more thought
into the extensions/helpers.

Thanks,
Ben

Reply all
Reply to author
Forward
0 new messages