Add support for generating an RSS 2.0 feed of the project news which

includes full content of each news item, not just titles, and better
integration with modern feed readers (e.g. Google Reader) than the
current RDF/RSS 0.9 feed.
This commit is contained in:
Murray Stokely 2008-01-07 07:50:27 +00:00
parent 442216331c
commit 19e98f4b5d
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=31233
3 changed files with 106 additions and 2 deletions

View file

@ -1,4 +1,4 @@
# $FreeBSD: www/en/news/Makefile,v 1.47 2007/03/15 16:21:15 murray Exp $
# $FreeBSD: www/en/news/Makefile,v 1.48 2008/01/04 21:16:27 jkois Exp $
.if exists(../Makefile.conf)
.include "../Makefile.conf"
@ -30,6 +30,7 @@ DEPENDSET.DEFAULT= transtable news press
XMLDOCS= newsflash:${XSL_NEWS_NEWSFLASH}:${XML_NEWS_NEWS_MASTER}:
XMLDOCS+= news-rdf:${XSL_NEWS_NEWS_RDF}:${XML_NEWS_NEWS_MASTER}:news.rdf
XMLDOCS+= news-rss:${XSL_NEWS_NEWS_RSS}:${XML_NEWS_NEWS_MASTER}:rss.xml
XMLDOCS+= press:${XSL_NEWS_PRESS}:${XML_NEWS_PRESS_MASTER}:
SUBDIR= 1993

View file

@ -1,5 +1,5 @@
# doc.xml.mk
# $FreeBSD: www/share/mk/doc.xml.mk,v 1.10 2006/09/22 21:05:03 hrs Exp $
# $FreeBSD: www/share/mk/doc.xml.mk,v 1.11 2006/10/07 04:05:33 trhodes Exp $
XML_CATALOG_FILES= file://${.OBJDIR}/catalog-cwd.xml \
file://${DOC_PREFIX}/${LANGCODE}/share/sgml/catalog.xml \
@ -142,6 +142,7 @@ XSL_USERGROUPS= ${WEB_PREFIX}/share/sgml/templates.usergroups.xsl
_DEPENDSET.news= ${XML_NEWS_NEWS_MASTER} ${XML_NEWS_NEWS} \
${XSL_NEWS_NEWSFLASH} \
${XSL_NEWS_NEWS_RDF} \
${XSL_NEWS_NEWS_RSS} \
${XML_INCLUDES}
_PARAMS.news= --param news.project.xml-master "'${XML_NEWS_NEWS_MASTER}'" \
--param news.project.xml "'${XML_NEWS_NEWS}'"
@ -155,6 +156,7 @@ XML_NEWS_NEWS= ${WEB_PREFIX}/share/sgml/news.xml
XSL_NEWS_NEWSFLASH= ${WEB_PREFIX}/share/sgml/templates.newsflash.xsl
XSL_NEWS_NEWSFLASH_OLD= ${WEB_PREFIX}/share/sgml/templates.oldnewsflash.xsl
XSL_NEWS_NEWS_RDF= ${WEB_PREFIX}/share/sgml/templates.news-rdf.xsl
XSL_NEWS_NEWS_RSS= ${WEB_PREFIX}/share/sgml/templates.news-rss.xsl
# DEPENDSET: press ..........................................................
_DEPENDSET.press= ${XML_NEWS_PRESS_MASTER} ${XML_NEWS_PRESS} \

View file

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE xsl:stylesheet PUBLIC "-//FreeBSD//DTD FreeBSD XSLT 1.0 DTD//EN"
"http://www.FreeBSD.org/XML/www/share/sgml/xslt10-freebsd.dtd" [
<!ENTITY title "FreeBSD News Flash">
<!ENTITY link "http://www.FreeBSD.org/news/">
<!ENTITY email "freebsd-www">
<!ENTITY realname "Webmaster Team">
]>
<!-- $FreeBSD$ -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:cvs="http://www.FreeBSD.org/XML/CVS"
exclude-result-prefixes="cvs">
<xsl:import href="http://www.FreeBSD.org/XML/www/lang/share/sgml/libcommon.xsl"/>
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="date">
<xsl:value-of select="//cvs:keyword[@name='freebsd']"/>
</xsl:variable>
<!-- Generate the main body of the RDF file -->
<xsl:template match="news">
<rss version="2.0">
<channel>
<title>&title;</title>
<link>&link;</link>
<description>News from the FreeBSD Project</description>
<language>en-us</language>
<webMaster>&email;@FreeBSD.org (&realname;)</webMaster>
<managingEditor>&email;@FreeBSD.org (&realname;)</managingEditor>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<ttl>120</ttl>
<image>
<url>http://www.FreeBSD.org/logo/logo-full.png</url>
<title>&title;</title>
<link>&link;</link>
</image>
<!-- Only include the last 10 events -->
<xsl:apply-templates select="descendant::event[position() &lt;= 10]"/>
</channel>
</rss>
</xsl:template>
<!-- Generate the <item> elements and their content -->
<xsl:template match="event">
<xsl:param name="year" select="../../../name" />
<xsl:param name="month" select="../../name" />
<xsl:param name="day" select="../name" />
<xsl:param name="this" select="." />
<xsl:param name="pos">
<xsl:for-each select="../event">
<xsl:if test=". = $this">
<xsl:value-of select="position()" />
</xsl:if>
</xsl:for-each>
</xsl:param>
<xsl:variable name="link">
<xsl:text>http://www.FreeBSD.org/news/newsflash.html#</xsl:text>
<xsl:call-template name="html-news-generate-anchor">
<xsl:with-param name="label" select="'event'" />
<xsl:with-param name="year" select="$year" />
<xsl:with-param name="month" select="$month" />
<xsl:with-param name="day" select="$day" />
<xsl:with-param name="pos" select="$pos" />
</xsl:call-template>
</xsl:variable>
<item>
<xsl:choose>
<xsl:when test="count(child::title)">
<title><xsl:value-of select="normalize-space(title)"/></title>
<description><xsl:value-of select="normalize-space(p)"/></description>
</xsl:when>
<xsl:otherwise>
<title><xsl:value-of select="normalize-space(p)"/></title>
</xsl:otherwise>
</xsl:choose>
<link><xsl:value-of select="normalize-space($link)"/></link>
<guid><xsl:value-of select="normalize-space($link)"/></guid>
<pubDate>
<xsl:call-template name="misc-format-date-string">
<xsl:with-param name="year" select="$year" />
<xsl:with-param name="month" select="$month" />
<xsl:with-param name="day" select="$day" />
<xsl:with-param name="date-format" select="$param-l10n-date-format-rfc822" />
</xsl:call-template>
</pubDate>
</item>
</xsl:template>
<xsl:template match="name | date"/>
</xsl:stylesheet>