There's a simpler version using Netlify redirects instead of Airtable here
by kentcdoddsJavaScript
Last 12 weeks · 0 commits
1 of 6 standards met
All Netlify sites include 125,000 function requests per month This seems like a pretty generous number, but let's say we are using this domain for ALL our sites to redirect our shortened urls. There are going to be urls I just need redirected, but not tracked. Not just because I want to save money, but because it will be faster than calling the function when there is not a need. My solution is to create a file based on a flag in airtable that is a checkbox to build the static redirects that do not need to call our redirect function. The solution uses a custom view by filtering on the field. Of course this could have been named anything. !image Notes: The file gets overwritten on each build The build will fail on a failure to build the _redirects file. 😀 (we want this) These redirects do not need to be ignored or removed from the select view for our function, because they will not fall through to Maybe someone at Netlify can confirm for us whether it is safe* to assume that redirects are handled in , redirects order. @kentcdodds : I have some experience with Netlify, so I was really intrigued with [your video][2], so was thinking about how it would really help me to track the clicks for a url also. This led me to realize there are a lot of links I just do not need to track and slow down the redirect by calling a function, but I still want to have them shortened. I have completed this code and did my tests on Netlify, just wondering if you are interested in [including this in your solution][1]. If so, I can PR and we can work on improving if needed or just discuss first here. [1]: https://github.com/kentcdodds/airtable-netlify-short-urls/compare/master...talves:netlify-redirects?expand=1 [2]: https://www.youtube.com/watch?v=Xs-qvWqoi2U
Repository: kentcdodds/airtable-netlify-short-urls. Description: There's a simpler version using Netlify redirects instead of Airtable here Stars: 59, Forks: 19. Primary language: JavaScript. Languages: JavaScript (99.9%), Hack (0.1%). Homepage: https://github.com/kentcdodds/netlify-shortener Open PRs: 0, open issues: 0. Last activity: 5y ago. Community health: 28%. Top contributors: horacioh.