The first step of the Second Development of nutch 1.2 war is to re-compile the homepage.

Source: Internet
Author: User
Tags xsl

The home page of nutch is ugly and implements some basic pages, like Baidu. If you perform secondary development on it, you have to read the source code and then repackage build. XML in Tomcat to release it. Of course. Here I have read and write it.

 

Pages in the nutch are written in XSLT and written in the source code src/web/style/nutch-page.xsl. Here there is a source code in the XSL format. Here you should understand the basic structure of it, otherwise it will fail to build. xml. So you have to try it step by step.

 

Basic Structure:

<? 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> your own title
</XSL: Text>
<XSL: value-of select = "title" Disable-output-escaping = "yes"/>
</Title>
<! -- Insert style insert your style
-->
<XSL: copy-of select = "document ('../include/style.html')"/>
<! -- Specify icon file introduces JS package
-->
<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>
<! --/Sorted ded menu -->
<! -- Included body -->
<XSL: Template Name = "body">
Your body

</XSL: Template>
<! --/Included body -->
</XSL: stylesheet>

I made a simple addition, deletion, and you should be able to see its changes carefully.

 

In this way, the re-packaging and deployment should be fine.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.