Adding Pages
User Guide → Adding PagesIt is easy to add files to a MarkBind site as any file inside the becomes a part of the generated website.
This includes any static assets such as images and other media files.
Example If you have an image images/logo.png in your root directory, it will be available as <website-url>/images/logo.png in the generated website.
Example If you have a file tutorial/code.txt in your root directory, it will be available as <website-url>/tutorial/code.txt in the generated website.
You can specify which files to be omitted from the site by using the ignore field in the site.config file as explained here.
More importantly, .md files can be transformed into HTML pages with matching names.
Example <root>/tutorial/setup.md can be transformed into <website-url>/tutorial/setup.html
Here are the steps to add a new page to your site:
.md file anywhere inside the root directory.pages attribute of the site.json to cover the new file, if necessary.You can easily include and deploy any external , along with your MarkBind site.
Example Your code coverage tool generates a HTML Coverage Report into a coverage folder and you want it to be accessible at <website-url>/coverage/index.html
The general approach is as follows:
pagesExclude attribute of the site.json file.markbind build to generate your MarkBind site.In the event that you only generate the static webpages in your CI build process, you may receive an invalid intra-link warning if you serve the MarkBind site locally. To disable it on a per-link basis, add {no-validation} at the end like this:
This is [my cool page generated from another tool](/my-cool-page/index.html{no-validation})
See the link Validation section for more details.
You can also use MarkBind to generate non-HTML files, such as .json or .txt, from your source .md files. This is useful for generating dynamic configuration files or other text-based assets that can benefit from MarkBind's variable system.
To do this, specify the fileExtension property for the page configuration in your site.json, as explained here.
Example Generating a sampleJson.json from sampleJson.md:
site.json:
{
"pages": [
{
"src": "userGuide/customFileTypes/sampleJson.md",
"fileExtension": ".json",
"searchable": "no"
}
]
}
sampleJson.md:
{
"title": "globalVariables",
"description": "This file is served as a .json file, but is sourced from a .md file in the source code.",
"baseUrl": "{{baseUrl}}",
"timestamp": "{{timestamp}}",
"MarkBind": "{{MarkBind}}"
}
Examples of generated custom files:
Key Points:
baseUrl, timestamp) and site variables within these files, just like in your HTML pages.enableSearch is true for the site. You can disable this by setting "searchable": "no" (or false) in the page config.{no-validation} tag, e.g. [sampleTxt](/userGuide/customFileTypes/sampleTxt.txt){no-validation} to disable intra-site validation warnings for the link, as MarkBind currently does not support intra-site validation for custom file type links.