`
mr_lonely_hp
  • 浏览: 89621 次
  • 性别: Icon_minigender_1
  • 来自: 湖南
社区版块
存档分类
最新评论

nutch 1.2 war的二次开发 第一步,重新编写首页

阅读更多

nutch的首页,比较难看,实现了一些基本页面,像baidu一样。你如果像对它进行二次开发的话,你就得读一下源码了,然后进行build.xml 重新打包在tomcat里发布了,当然。这里我已经对它进行了读写哈。

nutch 里的页面,是通过xslt 里编写的,在源码src/web/style/nutch-page.xsl 编写,这里有一个xsl格式的源码。这里你应该要读懂它的基本结构,不然会build.xml失败的。所以你要一步一步的试。

基本结构:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" />
<xsl:template match="page">
<html>
<xsl:comment>
This page is automatically generated. Do not edit!
</xsl:comment>
<head>
<!-- page title -->
<title>
<xsl:text>你自己定义的title </xsl:text>
<xsl:value-of select="title" disable-output-escaping="yes" />
</title>
<!-- insert style 插入你的样式 -->
<xsl:copy-of select="document('../include/style.html')" />
<!-- specify icon file 引入js包 -->
<script language="javascript" src="../resources/js/navMore-min.js"></script>
<script src="../resources/js/autoComplete-min.js"></script>
<script src="../resources/js/goso-slide-min.js"></script>
<script src="../resources/js/goso-waterMark-min.js"></script>
<script src="../resources/js/helpers-min.js"></script>
<script language="javascript" src="../resources/js/index.js"></script>

<script type="text/javascript">
<xsl:comment>
function queryfocus() {
search = document.search;
if (search != null) { search.query.focus(); }
}
<xsl:text>// </xsl:text>
</xsl:comment>
</script>
</head>
<body class="homeLink" onLoad="queryfocus();">
<xsl:call-template name="body" />
<xsl:copy-of select="document('../include/footer.html')"/>
</body>
</html>
</xsl:template>
<!-- included menu -->
<xsl:template name="subnavi">

</xsl:template>
<!-- /included menu -->
<!-- included body -->
<xsl:template name="body">
你的body
</xsl:template>
<!-- /included body -->
</xsl:stylesheet>

我作了简单的增删,你认真比较,应该能看出它的变化。

这样重新打包部署应该就没有问题了。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics