Video Title: How to create clean URL in fastn
Owner: Ajit
Audience: Common
Goal: To make understand Why and How of this featureWelcome to the video!
Today, we will learn how To Create a Clean URL in fastn
Generally the URL of the page is corresponding to the location of that page in the package.
This makes the URL more complex.To create the clean URL, we will learn about the document feature
of Sitemap
it helps to decouple the package organization and corresponding URLs. So you can keep files as you wish in the package but URL still does not depend on the path of the file.
It empowers the user to give a custom URL to the page
And That also helps to give a clean URL
Here we have two sections, Home and Season and the latter has 4 TOCs and each TOC has 2 sub TOCs.
Now to access these files my URL becomes the path of the file in this package.
So the URLs are long and complex.
And there is another limitation that I want to give a custom URL to this
section as current-season
but this url is same as summer, so we cannot
use this file with more than one url.
And if I want to use the file of summer season as my current season, It limits me to use the same path name as URL. So I cannot modify it.
Let me show how the URLs look in the browser.
When I click on season, it shows the summer season, which is the season at
the time of recording this video. But the URL displayed is this, instead I
wanted it as current-season
.
Also the URL has folder name. and if you check other URLs as well, it is not the path we want to be displayed.
So document feature
is the one stop solution to make the URL clean.
# Season: /current-season/
document
followed by colon and give the path
of the file.document: /seasons/summer.ftd
Make sure that when using document write the name of the file along with it's
extension .ftd
.
Now let's check in browser. There you go.
And just to confirm same file when opened with Summer Season toc, has the unchanged URL.
Now let's apply for other files too and check in the browser.
Now all URLs are clean and meaningful.fastn
website.
Support us by giving a star on GitHub and connect with our fastn community on
Discord.