summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse/.htaccess2
-rw-r--r--gentoobrowse/present/sitemap.xml.xml9
-rw-r--r--gentoobrowse/views/categories.xml2
-rw-r--r--gentoobrowse/views/package.xml9
-rw-r--r--gentoobrowse/xslt/sitemap.xslt36
5 files changed, 57 insertions, 1 deletions
diff --git a/gentoobrowse/.htaccess b/gentoobrowse/.htaccess
index c727c5d..e33d832 100644
--- a/gentoobrowse/.htaccess
+++ b/gentoobrowse/.htaccess
@@ -9,6 +9,8 @@ RewriteCond %{REQUEST_URI} !^/images/
RewriteCond %{REQUEST_URI} !^/[^/]+\.[^/]+$
RewriteCond %{REQUEST_URI} !^/p2web
RewriteRule ^(.*) /p2web/\1 [L]
+RewriteCond %{REQUEST_URI} ^/sitemap\.xml$
+RewriteRule ^(.*) /p2web/\1 [L]
FilterDeclare XSLT
FilterProvider XSLT XSLT resp=Content-Type $text/xml-xslt
diff --git a/gentoobrowse/present/sitemap.xml.xml b/gentoobrowse/present/sitemap.xml.xml
new file mode 100644
index 0000000..900fcc0
--- /dev/null
+++ b/gentoobrowse/present/sitemap.xml.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<view name="sitemap" root="gentoo" contenttype="text/xml-xslt" style="xslt/sitemap.xslt" xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:project2="http://project2.randomdan.homeip.net">
+ <xi:include href="../views/categories.xml" />
+ <xi:include href="../views/package.xml" />
+ <project2:view name="categories" source="categories" rootname="categories" recordname="category" />
+ <project2:view name="packages" source="sitemap-packages" rootname="packages" recordname="package" />
+</view>
+
diff --git a/gentoobrowse/views/categories.xml b/gentoobrowse/views/categories.xml
index 1faec02..e40ff98 100644
--- a/gentoobrowse/views/categories.xml
+++ b/gentoobrowse/views/categories.xml
@@ -3,7 +3,7 @@
xmlns:project2="http://project2.randomdan.homeip.net">
<project2:sqlrows name="categories" datasource="postgres-web">
<sql>
- SELECT c.categoryid, MIN(c.name) AS catname, COUNT(*) AS packages, MIN(c.summary) AS summary
+ SELECT c.categoryid, MIN(c.name) AS catname, COUNT(*) AS packages, MIN(c.summary) AS summary, MAX(p.firstseen) AS pkgfirstseen
FROM categories c, packages p
WHERE c.categoryid = p.categoryid
GROUP BY c.categoryid
diff --git a/gentoobrowse/views/package.xml b/gentoobrowse/views/package.xml
index af36f44..7f10887 100644
--- a/gentoobrowse/views/package.xml
+++ b/gentoobrowse/views/package.xml
@@ -1,6 +1,15 @@
<?xml version="1.0"?>
<block xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:project2="http://project2.randomdan.homeip.net">
+ <project2:sqlrows name="sitemap-packages" datasource="postgres-web">
+ <sql>
+ SELECT c.name AS catname, p.name AS pkgname, MAX(e.moddate) AS moddate
+ FROM categories c, packages p, ebuilds e
+ WHERE p.packageid = e.packageid
+ AND c.categoryid = p.categoryid
+ GROUP BY c.name, p.name
+ </sql>
+ </project2:sqlrows>
<project2:sqlrows name="packages" datasource="postgres-web">
<sql>
SELECT p.packageid, p.name AS pkgname, p.description, p.firstseen, c.name AS catname, p.herd, p.summary
diff --git a/gentoobrowse/xslt/sitemap.xslt b/gentoobrowse/xslt/sitemap.xslt
new file mode 100644
index 0000000..a90e150
--- /dev/null
+++ b/gentoobrowse/xslt/sitemap.xslt
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
+ xmlns:project2="http://project2.randomdan.homeip.net" exclude-result-prefixes="project2" >
+ <xsl:output encoding="utf-8" method="xml" media-type="text/xml" indent="yes" />
+ <xsl:template match="/gentoo">
+ <urlset>
+ <url>
+ <loc>http://gentoobrowse.randomdan.homeip.net/</loc>
+ <changefreq>daily</changefreq>
+ </url>
+ <url>
+ <loc>http://gentoobrowse.randomdan.homeip.net/popular</loc>
+ <changefreq>weekly</changefreq>
+ </url>
+ <url>
+ <loc>http://gentoobrowse.randomdan.homeip.net/categories</loc>
+ <changefreq>monthly</changefreq>
+ </url>
+ <xsl:for-each select="packages/package">
+ <url>
+ <loc>http://gentoobrowse.randomdan.homeip.net/package/<xsl:value-of select="catname" />/<xsl:value-of select="pkgname" /></loc>
+ <lastmod><xsl:value-of select="moddate" /></lastmod>
+ <changefreq>weekly</changefreq>
+ </url>
+ </xsl:for-each>
+ <xsl:for-each select="categories/category">
+ <url>
+ <loc>http://gentoobrowse.randomdan.homeip.net/category/<xsl:value-of select="catname" /></loc>
+ <lastmod><xsl:value-of select="pkgfirstseen" /></lastmod>
+ <changefreq>daily</changefreq>
+ </url>
+ </xsl:for-each>
+ </urlset>
+ </xsl:template>
+</xsl:stylesheet>
+