[Slashdotjp-dev 1545] [1076] Add HTML "<meta name=description>" into journal.pl: add first 250 chars of article on article page

Zurück zum Archiv-Index

svnno****@sourc***** svnno****@sourc*****
2009年 3月 17日 (火) 16:36:10 JST


Revision: 1076
          http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=1076
Author:   tach
Date:     2009-03-17 16:36:10 +0900 (Tue, 17 Mar 2009)

Log Message:
-----------
Add HTML "<meta name=description>" into journal.pl: add first 250 chars of article on article page

Modified Paths:
--------------
    slashjp/trunk/debian/changelog
    slashjp/trunk/plugins/Journal/journal.pl


-------------- next part --------------
Modified: slashjp/trunk/debian/changelog
===================================================================
--- slashjp/trunk/debian/changelog	2009-03-16 12:14:11 UTC (rev 1075)
+++ slashjp/trunk/debian/changelog	2009-03-17 07:36:10 UTC (rev 1076)
@@ -3,9 +3,10 @@
   * Add HTML "<meta name=description>" into sevaral pages
     - article.pl: already inserted, change content to introtext
     - index.pl: add data "meta_desc" and title of first 5 articles
+    - journal.pl: add first 250 chars of article on article page
   * Redirect Antenna URL on IndexHandler
 
- -- Taku YASUI <tach****@osdn*****>  Mon, 16 Mar 2009 12:13:50 +0000
+ -- Taku YASUI <tach****@osdn*****>  Tue, 17 Mar 2009 07:34:24 +0000
 
 slash (2.5.0.233-7) unstable; urgency=low
 

Modified: slashjp/trunk/plugins/Journal/journal.pl
===================================================================
--- slashjp/trunk/plugins/Journal/journal.pl	2009-03-16 12:14:11 UTC (rev 1075)
+++ slashjp/trunk/plugins/Journal/journal.pl	2009-03-17 07:36:10 UTC (rev 1076)
@@ -519,6 +519,8 @@
 
 	if (@$articles == 1) {
 	    $head_data->{html_title} = $articles->[0]->[2];
+	    $head_data->{meta_desc} = shorten(strip_nohtml($articles->[0]->[1]), 250);
+	    $head_data->{meta_desc} =~ s/[\r\n\s]+/ /g;
 	}
 	$head_data->{jcount} = scalar(@$articles);
 	_printHead('userhead', $head_data, 1) or return;
@@ -1002,6 +1004,8 @@
 	my $html_title = (defined($data->{html_title}) ? $data->{html_title}." - " : '') . $title;
 	my $options = { last_modified => $data->{last_modified} };
 
+	$options->{meta_desc} = $data->{meta_desc} if (defined $data->{meta_desc});
+
 	my $links = {
 		title		=> $html_title,
 		'link'		=> {



Slashdotjp-dev メーリングリストの案内
Zurück zum Archiv-Index