Learn full-stack web development using fastn in a week
Learn Now

Clean URLs using Custom URLs

fastn allows your to map documents to any URL you like, let's take a look at why and how.

Problem

fastn by default creates the URL based on the file path of a document, eg / corresponds to index.ftd and /docs/ looks for both docs.ftd and docs/index.ftd.

This ties URLs with folder hierarchy.

SEO Angle

This can cause some issues with organisation, as SEO and clean URL people want URLs to not have meaningless information, like your folder hierarchy.

Short URLs

URLs are good, for example for fastn.com, we have a processor called http processor and we often want to link to it using fastn.com/http/ which is short and easily memorable. But the document we store is in ftd-host/http.ftd based on our organisations guidelines.

Folder Organization

But you do not want to put all the documents on the top level, as without folder hierarchy it becomes hard to navigate.

document attribute in fastn.sitemap

fastn is configured using a file called FASTN.ftd, where you can define a sitemap of your site.

Normally your sitemap may look like this.
letting fastn guess the document based on url
-- fastn.sitemap:

- Home: /
- Docs: /docs/
Lang:
ftd
Auto guess can be overriden using the document attribute:
using document to specify document location
-- fastn.sitemap:

- Home: /
- Docs: /docs/
  document: documentation.ftd  
Lang:
ftd
There you go, make all your URLs clean, and folders organised! Do checkout the dynamic URLs guide to learn how to make URLs dynamic.