mdn / stumptown-deployer

🚢 those static Stumptown sites
Mozilla Public License 2.0
4 stars 6 forks source link

Drive redirects from a txt file #5

Open peterbe opened 5 years ago

peterbe commented 5 years ago

Netlify has the concept of a _redirects text file.

We can do something similar so that the redirects are handled by the git repo and not hardcoded. For example, we might, in stumptown-renderer check in a "redirects.txt" file which'd look like this:

/old/path/          [TAB]   /special/destination
/other/thing       [TAB]   https://example.com/foo

It wouldn't support wildcards with S3 websites but all the deployer needs to do is loop over that file and for each line (e.g. /old/path/) created an empty object (e.g. old/path/index.html) which is S3 website redirect metadata thing.