A Custom Index Page
This tutorial assumes you've completed the previous one.
When you visit localhost:3000, you see an index page
that was generated automatically by mdsite
. This page can be customized! This tutorial will
show you how to do that.
Step 1: Create index.md
Use your favorite editor to create an index.md
file in your src
folder.
Or you can run:
echo 'this is the index page' > src/index.md
Then, run
mdsite
to build your project.
You should now see your custom index page when you visit localhost:3000.
Step 2: Add a table of contents
The autogenerated index.html had a table of contents that linked to your "hello world" page. By customizing the index.html page, we lost that functionality. In this step, we'll add it back.
Use your editor to add a {{toc}}
line at the end of index.html. The whole file should look like this:
this is the index page
{{toc}}
Run mdsite
again. You should now see your custom index page, with a link to the "hello world" page, when
you visit localhost:3000