Explore MarkBind as a User
Getting to know MarkBind as a user will help you understand what MarkBind offers and how it can be used to create static websites. This will also help you understand the different components and syntax available in MarkBind, which will be useful when you want to debug issues or create similar features in the future.
As mentioned in our user guide, we can either install MarkBind via npm or create a new MarkBind site with npx.
In this bootcamp, we want to set up the master branch MarkBind so that we can test out any changes we make to the codebase on our local machine.
You can also switch between the master branch MarkBind and check out other branches if you are working on multiple issues. This is also useful when you want to test out a PR submitted by another developer.
Checkpoint
After setting up MarkBind, try running from the root directory of your MarkBind repository:
markbind -v
to check that you have the correct version of MarkBind installedcd docs && markbind serve -d
to check that you can serve the MarkBind documentation site in development modeIf you can browse the MarkBind documentation site that should have automatically been up in your browser at http://localhost:8080, you have successfully set up MarkBind!
With MarkBind installed, we can now create a new MarkBind site.
We recommend that you set up a new repository for this MarkBind site so that you can push your site to GitHub pages later. This MarkBind site can be used to test out any changes you make to the codebase.
As an example, let's create a test site together!
markbind init
to create a new MarkBind site with the default template.git init
. You can also create a new public repository on GitHub first and clone it to your local machine.You should see the following output:
$ markbind init
__ __ _ ____ _ _
| \/ | __ _ _ __ | | __ | __ ) (_) _ __ __| |
| |\/| | / _` | | '__| | |/ / | _ \ | | | '_ \ / _` |
| | | | | (_| | | | | < | |_) | | | | | | | | (_| |
|_| |_| \__,_| |_| |_|\_\ |____/ |_| |_| |_| \__,_|
v4.0.2
info: Initialization success.
Checkpoint
After setting up the MarkBind test site, try running the following common operations from the root directory of your test site:
markbind build
markbind serve
markbind serve -d
You now have the test site up and running!
MarkBind contains a range of additional syntax on top of Markdown. It also comes with a set of components that can be used to create content.
Two essential sections of the user guide to get started with are:
The generated MarkBind site from the above step also includes a few sample usage in the index.md
file.
Now, let's try editing the index.md
file to add some content of our own!
index.md
file in your mb-dev-xxx
folder.Landing Page Title
with MarkBind Developer Test Site
.Checkpoint
With live preview, you should be able to see the changes you have made to the site after saving. Check that the following are true:
markbind serve -d
index.md
file and saveYou now have created content with MarkBind!
There are a few ways to modify the site's (as well as the page's) structure and configuration. We will cover the following:
Let's continue with the test site we created earlier and modify the index.md
file via frontmatter.
index.md
file in your mb-dev-xxx
folder.pageNavTitle
in the frontmatter from Topics
to Index Page
.pageNav
in the frontmatter from 4
to 5
.Checkpoint
Ensure that you are still serving the site with markbind serve -d
. Check that the following are true:
Index Page
H5
headings as wellScreenshot before the changes:
Screenshot after the changes:
Another commonly adjusted structure is the layout of the site (especially, the site's top header and the left-hand-side navigation).
_markbind/layouts/default.md
file in your mb-dev-xxx
folder.Your Logo
to MarkBind Developer Test Site
.Home :house:
to My Test Playground :computer:
.Checkpoint
Ensure that you are still serving the site with markbind serve -d
. Check that the following are true:
MarkBind Developer Test Site
My Test Playground
💻Screenshot after the changes:
Lastly, let's modify the site configuration to change the site title and more.
The site.json
file is autogenerated and located in the root directory of the site. Refer to the User Guide - site.json
section for more details.
site.json
file in your mb-dev-xxx
folder."titlePrefix": "",
to "titlePrefix": "mb-dev-xxx",
.pages
, add "title": "Home"
.Checkpoint
Ensure that you are still serving the site with markbind serve -d
. Check that the following are true:
mb-dev-xxx - Home
Screenshot after the changes:
You now have modified some of the commonly adjusted site structure and configuration!
MarkBind sites can be easily deployed with CLI commands or via CI. Let's try deploying our site via GitHub Actions.
site.json
file in your mb-dev-xxx
folder."baseUrl": "",
to "baseUrl": "/mb-dev-xxx",
(Note the leading /
and that the value is the same as your GitHub repository name)..github/workflows/deploy.yml
file with the following content mentioned in the GitHub Actions guide.
branches: master
to branches: main
if you are using the main
branch.xxx
with your GitHub username):git remote add origin https://github.com/xxx/mb-dev-xxx.git
main
branch with the following commands:git add .
git commit -m "Update content"
git push origin main
Deploy from a branch
and the branch to gh-pages
and /(root)
.Checkpoint
Check that the following are true:
https://<username>.github.io/mb-dev-xxx/
(after a few seconds to a few minutes)Congratulations! 🎉🎉🎉 You have deployed your MarkBind site!
In the first part of this bootcamp, we experimented with MarkBind as a user. We have set up the master branch of MarkBind and created a new MarkBind site. We have also created content with MarkBind components/syntax and deployed our site.
Here are some additional tasks for you to try out:
Take a break now ☕️ and we will continue with the second part of the bootcamp!