Single Page App
Whenever a link to another internal page is clicked or a popstate event is fired, mspa.js will:
- Fetch
<url>/index.json; - Update the following elements :
#contentelement ;document.title;<meta name="description" />.
- Call the
postFetch()function.
mspa generates an index.json file along with each index.html if JS is disabled:
{
"uri": "/uri/to/page",
"page_content": "...",
"meta": {
"name": "...",
"description": "...",
...
}
}
mspa.js provides the following features :
- Syntax highlighting with
highlight.js; - Math typesetting with
Katex; - Anchor behavior for any
h2title. - Single page app navigation ;
This is default behavior with projects generated with
mspa new, you can remove/modifymspa.jsas necessary.