Skip to content

Commit 45036e7

Browse files
committed
Displaying document title in html/head/title - not pretty, should use same algorithm as dq:print-headings(), but it works
1 parent 48500ac commit 45036e7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/config.xqm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ declare function config:expath-descriptor() as element(expath:package) {
6060
$config:expath-descriptor
6161
};
6262

63-
declare %templates:wrap function config:app-title($node as node(), $model as map(*)) as text() {
64-
$config:expath-descriptor/expath:title/text()
63+
declare %templates:wrap function config:app-title($node as node(), $model as map(*)) as xs:string {
64+
let $doc-uri := request:get-uri()
65+
let $doc-path := concat(replace(replace($doc-uri, '^/exist/', '/db/'), concat('^(.*)', '/','.*'), '$1'), '/data/', replace($doc-uri, concat('^.*','/'),''))
66+
let $doc-title := doc($doc-path)/book/bookinfo/title
67+
return
68+
concat($config:expath-descriptor/expath:title, if ($doc-title) then ' - ' else '', $doc-title)
6569
};
6670

6771
declare function config:app-meta($node as node(), $model as map(*)) as element()* {

0 commit comments

Comments
 (0)