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>

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

 

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章