Website Structure and Pages in ↓markdown↓ CMS
The ↓markdown↓ Content Management System (CMS) is designed with simplicity in mind. No database is used to store website content because it is a flat file CMS. The website content is taken directly from the folders and files on the web server's public directory (the folder which stores all the information to send to a visitor's browser). Thus folder and files are structure and content. Each page on the website is stored in a Markdown or CommonMark file, a plain text file with a .md extension. Creating a directory and text file on the web server's public HTML folder creates a structure and page content (here the folder public_html on the webserver stores a website's content and example.com is used for the domain name):
- .../public_html/index.md for example.com
- .../public_html/apage.md for example.com/apage
- .../public_html/sub/page.md for example.com/sub/page
Example Website Structure for a Coffee Shop
This example assumes that ↓markdown↓ CMS is being used for a website for a coffee shop. The coffee shop owner wants these pages on the website:
- Home Page - example.com
- Menu - example.com/menu
- Offers - example.com/special-offers
- Hours of Business - example.com/opening-times
- Contact - example.com/address
- About - example.com/about-us
For ↓markdown↓ CMS website the following files would achieve that structure:
- .../public_html/index.md - example.com
- .../public_html/menu.md - example.com/menu
- .../public_html/special-offers.md - example.com/special-offers
- .../public_html/opening-times.md - example.com/opening-times
- .../public_html/address.md - example.com/address
- .../public_html/about.md - example.com/about
The shop owner decides that the menu page is too crowded and wants different pages for the different sections:
- Coffee Menu - example.com/menu/coffee
- Cakes Menu - example.com/menu/cakes
- Sandwiches Menu - example.com/menu/sandwiches
Thus .../public_html/menu.md is removed and replaced with a folder and three files, becoming:
- .../public_html/menu/coffee.md - example.com/menu/coffee
- .../public_html/menu/cakes.md - example.com/menu/cakes
- .../public_html/menu/sandwiches.md - example.com/menu/sandwiches
The shop owner wants the address page to have a map and directions page below it:
- .../public_html/address/index.md - example.com/address
- .../public_html/address/map.md - example.com/address/map
- .../public_html/address/directions.md - example.com/address/directions
Notice in the last example how a folder gets its own URL by creating an index.md file inside it. The same way the Home Page is created.
Organising a Website
The website structure will depend upon the amount of information that needs to be published. A small informational company website may only require a few web pages. In which case creating a few .md files in the root folder is all that is required, much like the coffee shop example above. A website publishing a lot of pages on many topics will use category sub-folders for easy management. For a website that has content added on a regular basis naming folders after dates can help. Here named after years and months:
- .../public_html/2015-11/pageX.md
- .../public_html/2015-11/pageY.md
- .../public_html/2015-11/pageZ.md
- .../public_html/2015-12/page1.md
- .../public_html/2015-12/page2.md
To organise media create sub-folders off the content folders, instead of all the media for the whole site being thrown into the same folder:
- .../public_html/topic/images
Back to Build a Website from Scratch with ↓markdown↓ CMS.
Author:Daniel S. Fowler Published: