Commit 56b0bf3d authored by Marie Bisson's avatar Marie Bisson
Browse files

Update index.xqm

parent 08baea35
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -14,13 +14,18 @@ returns a new generated one if not
declare
%rest:GET
%output:method("html")
%output:html-version("5.0")
%output:indent("no")
%output:encoding("UTF-8")
%rest:path("/{$project}/index/{$type}.html")
function max.plugin.index:index($project,$type){
  let $indexFilePath :=file:parent(file:parent(file:parent(static-base-uri()))) || '/editions/'||$project||'/fragments/index_'||$type||'.frag.html'
  return
    if(file:exists($indexFilePath))
    then 
          let $content := <div id='content'>{doc($indexFilePath)}</div>
      let $content := fetch:xml($indexFilePath, map {'chop' : false()})
      let $content := <div id='content'>{$content}</div> 
          (:~ let $content := <div id='content'>{doc($indexFilePath)}</div>~:)
          return max.html:render($project, 'index', $content) 
    else max.plugin.index:generateIndex($project,$type)
};