1 # Blosxom plugin: storytitle
2 # Author(s): Struan Donald <code@exo.org.uk>
4 # Documentation: see bottom of file or perldoc title
8 # ------------------ Config variables ---------------------
10 # default seperator to add to story title
14 # do we default to the right aligned title
15 # 1 for right aligned, 0 for left
19 # seperator for right aligned title
24 # seperator for left aligned title
29 # ---------------------------------------------------------
33 my ($p, $dir, $head) = @_;
36 $title = (defined $blosxom::path_info_da ? "$blosxom::path_info_da/" : "") . (defined $blosxom::path_info_mo ? "$blosxom::path_info_mo/" : "") . "$blosxom::path_info_yr" ;
38 } elsif ($dir =~ m#(.*?)/?([\-\.\w]+)\.(\w+)$# and $2 ne 'index') {
39 $file = join('/', $blosxom::datadir, $1, "$2.txt");
40 my $fh = new FileHandle;
41 if (-f "$file" && $fh->open("< $file")) {
42 chomp($title = <$fh>);
46 if (defined $title and $title =~ /\S/) {
47 $page_title_right = $right_sep . $title;
48 $page_title_left = $title . $left_sep;
49 $page_title = $right ? $page_title_right : $page_title_left;
50 } else { # these need to be reset otherwise we'll get the last value
51 $page_title_right = undef;
52 $page_title_left = undef;
62 Blosxom Plug-in: storytitle
66 Allows you to include the story title in the page header for individually views blosxom stories.
70 Put title in your plug-ins directory.
72 If required change the $sep variable. This controls the seperator that goes at the start of the story title. E.g. if $sep is ' : ' and the story title is 'A blosxom entry' then the plugin will return ' : A blosxom entry'.
74 Now all individually displayed stories can have their title in the pages title tag, or anywhere else in the page header you want. Just place $storytitle::page_title where you want to display the story title.
76 =head2 LEFT AND RIGHT ALIGNED TITLES
78 If you have a need for a left aligned title (i.e. you want to have 'story title : somethign else') then you can use either $storytitle::page_title_left or set the value of $right in the configuration to 0. In that case $storytitle::page_title will have the seperator at the left.
80 You can also individually configure the left and right sided seperators with the left_sep and right_sep configuration options. $storytitle::page_title_left and $storytitle::page_title_right will access the left and right sided titles.
88 0.5 - deals with filenames with like foo.bar.txt and foo-bar.txt (thanks to
89 Antti Vähä-Sipilä for pointing this out)
90 catches titles containing only white space.
92 0.4 - bugfix to stop title values hanging around under static generation
94 0.3 - fixed left_title to actually be a left title
96 0.2 - introduced left and right options
100 Struan Donald <code@exo.org.uk>, http://exo.org.uk/code/
104 Lim Chee Aun <http://phoenity.com/> for the left/right sided titles idea.
108 Blosxom Home/Docs/Licensing:http://blosxom.sourceforge.net/
110 Blosxom Plugin Docs: http://blosxom.sourceforge.net/documentation/users/plugins.html
114 None known; please send bug reports and feedback to the Blosxom
115 development mailing list <blosxom-devel@lists.sourceforge.net>.
119 Copyright (C) 2003 Struan Donald.
121 This program is free software; you can redistribute
122 it and/or modify it under the same terms as Perl itself.