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

Back to archive index

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


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

Log Message:
-----------
Add HTML "<meta name=description>" into journal.pl: add first 250 chars of article tltles on index 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-17 07:36:10 UTC (rev 1076)
+++ slashjp/trunk/debian/changelog	2009-03-17 07:45:01 UTC (rev 1077)
@@ -4,9 +4,10 @@
     - 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
+    - journal.pl: add first 250 chars of article titles on index page
   * Redirect Antenna URL on IndexHandler
 
- -- Taku YASUI <tach****@osdn*****>  Tue, 17 Mar 2009 07:34:24 +0000
+ -- Taku YASUI <tach****@osdn*****>  Tue, 17 Mar 2009 07:44:20 +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-17 07:36:10 UTC (rev 1076)
+++ slashjp/trunk/plugins/Journal/journal.pl	2009-03-17 07:45:01 UTC (rev 1077)
@@ -518,10 +518,15 @@
 	}
 
 	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->{html_title} = $articles->[0]->[2];
+		$head_data->{meta_desc} = $articles->[0]->[1];
+	} else {
+		foreach my $a (@$articles) {
+			$head_data->{meta_desc} .= $a->[2] . "\x{3002}" if ($a->[2]);
+		}
 	}
+	$head_data->{meta_desc} = shorten(strip_nohtml($head_data->{meta_desc}), 250);
+	$head_data->{meta_desc} =~ s/[\r\n\s]+/ /g;
 	$head_data->{jcount} = scalar(@$articles);
 	_printHead('userhead', $head_data, 1) or return;
 



Slashdotjp-dev メーリングリストの案内
Back to archive index