library-web r458 - in trunk: . data/xslt



Author: fpeters
Date: Sat May 17 20:55:37 2008
New Revision: 458
URL: http://svn.gnome.org/viewvc/library-web?rev=458&view=rev

Log:
* data/xslt/indexes.xsl: added generation of a robots.txt file listing
versioned path, so only /stable/ and /unstable/ URLs will be indexed.
(closes: #509424)



Modified:
   trunk/ChangeLog
   trunk/data/xslt/indexes.xsl

Modified: trunk/data/xslt/indexes.xsl
==============================================================================
--- trunk/data/xslt/indexes.xsl	(original)
+++ trunk/data/xslt/indexes.xsl	Sat May 17 20:55:37 2008
@@ -741,6 +741,7 @@
     </exsl:document>
   </xsl:template>
 
+  <!-- Google sitemap stuff -->
   <xsl:template match="document" mode="sitemap">
     <xsl:if test="@path"> <!-- only local documents -->
       <url xmlns="http://www.google.com/schemas/sitemap/0.84";>
@@ -794,6 +795,34 @@
     </exsl:document>
   </xsl:template>
 
+
+  <!-- robots.txt stuff -->
+
+  <xsl:template match="document" mode="robotstxt">
+    <xsl:if test="versions">
+      <xsl:variable name="basedir">/<xsl:value-of  select="@channel"
+      />/<xsl:value-of select="@modulename" />/</xsl:variable>
+      <xsl:for-each select="versions/version">
+        <xsl:text>Disallow: </xsl:text>
+	<xsl:value-of select="$basedir"/><xsl:value-of select="@href"/>
+	<xsl:text>/
+</xsl:text>
+      </xsl:for-each>
+    </xsl:if>
+  </xsl:template>
+
+  <xsl:template match="indexes" mode="robotstxt">
+    <xsl:message>Writing robots.txt</xsl:message>
+    <exsl:document href="robots.txt" method="text" encoding="UTF-8">
+      <xsl:text># don't let robot index all versions of documents
+# see http://bugzilla.gnome.org/show_bug.cgi?id=509424
+User-agent: *
+</xsl:text>
+      <xsl:apply-templates select="//document" mode="robotstxt"/>
+    </exsl:document>
+  </xsl:template>
+
+  <!-- JavaScript related translations -->
   <xsl:template match="home" mode="javascript">
     <xsl:param name="lang" select="@lang"/>
     <xsl:param name="language_cookie"
@@ -823,6 +852,7 @@
       </xsl:apply-templates>
     </xsl:for-each>
     <xsl:apply-templates select="." mode="sitemap"/>
+    <xsl:apply-templates select="." mode="robotstxt"/>
     <xsl:apply-templates select="home" mode="javascript"/>
   </xsl:template>
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]