Want to try fastn for your company's website?
Book a Demo

Understanding Sitemap

In this video we learn about `sitemap`
`Sitemap` is used to create a structured representation of the files and pages that make up a website. This structure is created over a layout which we will talk about in a bit. By creating a comprehensive sitemap, website owners and visitors can gain a clear understanding of the website's structure and easily navigate through its content. It ensures that visitors can find the information they need efficiently.

Why `sitemap`?

Just like a college library needs to organise their shelves, books in an order based on cateogry or genre. Similarly, in a package, we want to organise the documents in different sections, subsections and TOCs. `Sitemap` serves as a blueprint or roadmap, providing information about the organization and hierarchy of content on the website.

How to configure `sitemap` for your site

We create the sitemap in the `FASTN.ftd`. So, we write:
-- fastn.sitemap:

# Section: <url>

## SubSection: <url>

- TOC-1: <url>
- TOC-2: <url>
- SubTOC-2-1: <url>
- SubTOC-2-2: <url>

...
Lang:
ftd
and after a line space - for `sections` we use `#` - for `subsections` we use `##`, and - for `TOCs` and `sub-TOCs` we use `-`
In all the three cases, whatever written before colon is displayed as the title on webpage and whatever is written after colon, becomes the URL to access it.

First section

We put our first section like, hash for section, home as section name and URL:
# Home: /
Lang:
ftd
Section `Home` is displayed on the webpage, which displays the content of `index.ftd` document. The URL `/` corresponds to `index.ftd` document. Whereas, any document other than `index.ftd` file we need to write something after `/`. For example, there is a file `foo.ftd`, then to access the foo document, we need to write, `/foo/`.

Second section

Let's add another section.
# Season: /season/summer/
Lang:
ftd
The URL is the path of the document. Inside folder season, there is a document called `summer.ftd`.

Subsections

Let's give some subsections to this section `season`.
## Autumn: /season/autumn/

## Spring: /season/spring/

## Summer: /season/summer/

## Winter: /season/winter/
Lang:
ftd

TOCs

Similarly, we can add TOCs. TOCs start with single dash or hyphen `-`, followed by TOC title before colon and after the colon, as usual, the URL. Also note, between TOCs we do not give a line space.
- Sunrise: /season/day-event/sunrise/
- Sunset: /season/day-event/sunset/
Lang:
ftd
and so on, you can give any number of TOCs and even sub-TOCs to the sections or subsections.
# Home: /

# Season: /season/summer/


## Autumn Season: /season/autumn/

- Sunrise: /season/day-event/sunrise/
- Sunset: /season/day-event/sunset/

## Spring Season: /season/spring/

- Sunrise: /season/day-event/sunrise/
- Today's News: /season/day-event/news/rained/
- Sunset: /season/day-event/sunset/

## Summer Season: /season/summer/

- Sunrise: /season/day-event/sunrise/
- Sunset: /season/day-event/sunset/

## Winter Season: /season/winter/

- Sunrise: /season/day-event/sunrise/
- Sunset: /season/day-event/sunset/
Lang:
ftd
The URLs can be cleaned and customized by using the `document feature` of sitemap.
# Home: /

# Season: /current-season/
document: /season/summer.ftd


## Autumn: /autumn/
document: /season/autumn.ftd

- Sunrise: /sunrise-in-autumn/
document: /season/day-event/sunrise.ftd
- Sunset: /sunset-in-autumn/
document: /season/day-event/sunset.ftd

## Spring: /spring/
document: /seasons/spring.ftd

- Sunrise: /sunrise-in-spring/
document: /season/day-event/sunrise.ftd
- Today's News: /news-of-the-day/
document: /season/day-event/news/rained.ftd
- Sunset: /sunset-in-spring/
document: /season/day-event/sunset.ftd

## Summer: /summer/
document: /season/summer.ftd

- Sunrise: /sunrise-in-summer/
document: /season/day-event/sunrise.ftd
- Sunset: /sunset-in-summer/
document: /season/day-event/sunset.ftd

## Winter: /winter/
document: /season/winter.ftd

- Sunrise: /sunrise-in-winter/
document: /season/day-event/sunrise.ftd
- Sunset: /sunset-in-winter/
document: /season/day-event/sunset.ftd
Lang:
ftd
To know all about this feature you can checkout the video about [`How to create clean URLs`](/clean-urls/).
Thank you guys, keep watching these videos to learn more about fastn. Support us by giving a star ⭐ on [GitHub](https://github.com/fastn-stack/fastn/) and join our fastn community on [Discord](/discord/).