Skip to content

Instantly share code, notes, and snippets.

@ableasdale
Created February 17, 2016 14:19
Show Gist options
  • Save ableasdale/7b231049d495d622dc3e to your computer and use it in GitHub Desktop.
Save ableasdale/7b231049d495d622dc3e to your computer and use it in GitHub Desktop.
MarkLogic Bootstrap Page Template
xquery version "1.0-ml";
declare function local:create-bootstrap-page($title as xs:string, $content as element()){
element html { attribute lang {"en"},
element head {
element meta { attribute charset {"utf-8"}},
element meta { attribute http-equiv {"X-UA-Compatible"}, attribute content {"IE=edge"} },
element meta { attribute name {"viewport"}, attribute content {"width=device-width, initial-scale=1"} },
element title {$title},
element link {
attribute rel {"stylesheet"},
attribute href {"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"},
attribute integrity {"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7"},
attribute crossorigin {"anonymous"}
},
element link {
attribute rel {"stylesheet"},
attribute href {"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"},
attribute integrity {"sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r"},
attribute crossorigin {"anonymous"}
}
},
element body {
$content,
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">{" "}</script>,
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous">{" "}</script>
}
}
};
xdmp:set-response-content-type("text/html; charset=utf-8"),
'<!DOCTYPE html>',
local:create-bootstrap-page("bootstrap 101 template", element h1{"hello"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment