kcl-ddh / kiln

Kiln is a multi-platform framework for building and deploying complex websites whose source content is primarily in XML. It brings together various independent software components into an integrated whole that provides the infrastructure and base functionality for such sites.
Apache License 2.0
34 stars 62 forks source link

How to implement a samples index by duplicating text files? #16

Closed IoannaKy closed 7 years ago

IoannaKy commented 9 years ago

I have duplicated text-index.xml and text-file-list-to-html.xsl in order to create a samples index to display a list of samples files. I added a sample index pipeline in the main.xmap but it's not working. The problem is that in the sample index page the files appear duplicated and for example when clicking on a file this URL appear http://localhost:9999/samples/samples/HGV.73151.html. How can I fix that and have this URL working instead http://localhost:9999/samples/HGV.73151.html? Currently when writing that URL I get the following error: The resource you requested was not found. java.io.FileNotFoundException: /vagrant/webapps/ROOT/sitemaps/../kiln/sitemaps/../../sitemaps/../content/xml/tei/HGV.73151.xml (No such file or directory) Also how can I display only the files from samples directory without other files appearing on the list from content/xml/tei?

Thank you in advance for your help!

ajenhl commented 9 years ago

It's hard to know without seeing the sitemap and XSLT. If you have TEI files in content/xml/tei/samples that you want to be displayed at /samples/, you should either create a pipeline map:match for that URL pattern (use the map:match with id local-tei-display-html in sitemaps/main.xmap as a guide) or (if you want to display all the TEI files in content/xml/tei/ in a URL structure matching the directory structure) modify the local-tei-display-html map:match so that the pattern is **.html and not text/**.html.

Be aware that the latter case means that all requests for HTML files on the site that aren't caught by an earlier map:match will be caught by this pattern (which is why it is under the text path by default).

The error message you are getting demonstrates that the map:match that catches /samples/**.html is using a map:generate or map:part pointing to something like cocoon://internal/tei/preprocess/{1}.xml - so the samples part is being omitted, leading to the error. You can add it in manually to the map:generate or map:part, or make the whole map:match more generic (these are the two options I mention above).