S2 Cookbook: Linking the title on your journal to your main journal page

From Dreamwidth Notes
Jump to: navigation, search

Here is a theme layer that will add link the journal's title to the main journal page. These functions could also be used in a layout layer. If you are using this with another layout's theme, copy the theme layer code from the public layer list and add the functions onto the end.

layerinfo "type" = "theme";
layerinfo "name" = "Linked Titles";
layerinfo "is_public"       = 1;
layerinfo "source_viewable" = 1;
 
function Page::print_global_title() {
    if ($.global_title) {
        """<h1 id="title"><a href="$.base_url"><span>""" + $.global_title + """</span></a></h1>""";
    }
}
 
function FriendsPage::print_global_title() {
 
    """<h1 id="title"><a href="$.base_url"><span>""";		
    if ($.friends_title) {
        $.friends_title;
    }
    else {
        $.global_title;
    }
    """</span></a></h1>""";
}