retypeapp / retype

Retype is an ✨ ultra-high-performance✨ static site generator that builds a website based on simple text files.
https://retype.com
Other
1.01k stars 201 forks source link

NFR: Permalinks and/or static redirects (SEO) #689

Open noone-silent opened 3 months ago

noone-silent commented 3 months ago

There are currently two ways to change a link or a redirect. But both are not really writer friendly and with a lot of them would make the project file structure unreadable.

If you change your file structure and you already have put out the links somewhere, you need to make sure old users still find the related content. Else it would result into a 404 and this would have an impact on SEO.

You could create a md file with the old name and have a redirect: XXX inside. This is working, but if you have many such changes, it would make the project unreadable.

Overwrite the route: XXX in the page. This would only generate one route, but that's not what we looking for.

Possible solution: In the project configuration, add a new field like redirects, like this:

  redirects:
    - old: /some/old/path
      new: /to/new/path
      code: 301
    - old: /some/other/old/path
      new: /other/new/path
      code: 302
    - old: /some/obsolete/path
      code: 410

Probably this should create a .htaccess file with all the redirects.

Permalinks On a page add a new field permalink. For example:

  permalink: something-short

The permalink is only from the root path like https://retype.mygreat.docs/something-short. Also this field should not contain paths like /here-we/go-to to avoid interfering with generated paths. (EDIT: maybe add a prefix like /permalinks/ and make it a reserved keyword too, so it would be https://retype.mygreatdocs/permalinks/something-short)

On Build this should create HTML files in the root which simply redirect to the correct page. This is not important for SEO, but helps with giving customers a fixed link, without looking up the correct URL.