February 3rd, 2004


Removing [ << foo ] links

Some pages (http://www.livejournal.com/customize/advanced/layers.bml for example) make use of navigation links that involve little arrows in square brackets. This was useful in the past, but what with the advent of breadcrumbs, it may not be as useful anymore.

Talk has been made of removing these from any pages that have them, but we wanted to get some feedback from the community just in case there's something we're missing.


Creating and Using Breadcrumbs

Figured I'd write up a short guide to dealing with crumbs, as that's what I've spent the majority of the past few days dealing with.

First off, crumbs are organized in a tree. The base of the tree is 'home', which is the front page. Every crumb has a unique key for itself and one (only one) parent. Each crumb is also defined as having a default English title and a link to its page.

In the relevent crumbs definition files (cgi-bin/crumbs.pl and crumbs-local.pl) you will find the hashes that define the crumbs. If you want to add a new crumb, you need to add it to one of these files. Note that crumbs in crumbs-local.pl will override crumbs in crumbs.pl. Files from ljcom NEED to have their crumbs put into crumbs-local.pl.

The hashes are organized as so:

     'unique_key' => [ 'Title of Crumb', '/some/page.bml', 'my_parent' ]

That's a static crumb. Once you've defined one of those in the relevant Perl file, you can then tell LiveJournal to display that crumb on a BML page by using this code:


Run that anywhere inside of a BML page's code block. If you have a page that doesn't have a code block, you should insert one in the following manner:

     return LJ::set_active_crumb('unique_key');

There is also the capability to insert dynamic crumbs. If you wish to have a crumb title reflect something like "Support Request #1784835" then you will need to use a dynamic crumb. You can use it something like this:

     LJ::set_dynamic_crumb(BML::ml('.foo', { 'num' => 5 }), 'parent');

Notice that we call BML::ml. This means that the crumb title can be pulled from the translation database, and you can still stick in the data that you want.

I think that's about it. Let me know if there are any questions, or if any of this is unclear. Thanks!

Update: I forgot to mention. When you edit the crumbs files, you need to put them into the translation database. This is, as you probably expected, done with bin/upgrading/texttool.pl. In specific, there is a new "loadcrumbs" option as well as a "wipecrumbs" option.

The easiest way is to do:

    bin/upgrading/texttool.pl load

If you use loadcrumbs instead of load, make sure to also use the makeusable mode so that the crumbs really show up on the site.