Output XML file for sphinx or manticore search

I just finished my website search function with manticoresearch.
I have been playing Hugo for about 10 days. It is a realy great tool.
I want to share the hugo part here.
I add the following code to config.toml

    baseName = "sphinx"
    isPlainText = true
    mediaType = "application/xml"
    path = "/"

home = [ "HTML", "RSS", "sphinx" ]

and on layout/_default/ folder I create a new file list.sphinx.xml. The content is below:

        <?xml version="1.0" encoding="utf-8"?>
              <sphinx:field name="title"/>
              <sphinx:attr name="title" type="string"/>
              <sphinx:attr name="link" type="string"/>
              <sphinx:field name="content"/>
              <sphinx:attr name="content" type="string"/>
              <sphinx:attr name="pubDate" type="timestamp"/>
            {{ range $i, $e:= .Pages }}
            <sphinx:document id="{{ add $i 1080 }} ">
              <title><![CDATA[{{ .Title }}]]></title>
              <link><![CDATA[{{ .Permalink }}]]></link>
              <pubDate>{{ (time ( .Date)).Unix }}</pubDate>
              <content><![CDATA[{{ .Plain }}]]></content>
            {{ end }}

That’s all. Hugo will generate a sphinx.xml on root folder. Then It can be indexed by sphinxsearch or manticoresearch.

This way, you can make a search function by your own.