Hello, I have been using Netlify for a while, I wanted to try few things and I saw a post not so long ago that some user was needing help similar like mine. The post that I am talking about is:
I tried a few days using this code, if (event.headers.referer.includes(‘website’)), it works perfectly when I am visiting from “website” referral but when I try to visit it directly I have an error that says “includes” is not recognized, is there someone that can help me? I did a lot of re search before posting this and I found nothing. Below is screenshot of the error.
You are amazing. I can’t express how much I appreciate your help. I have one last issue. In the else part, which means if the referer is not matching, how I can show them the actual content example from /post/ directory? As you can see on the facebook post below, if you open the link directly (decoded) you’ll notice that it won’t redirect anywhere but instead show the content from that URL. I also opened the the page source and there are not any scripts. I have no idea how he achieves that.
coelmay, I have been trying for few days and I thought I could do it by myself but I couldn’t manage it to work with the referral script above, I did made some changes as you can see on my Github but no luck. Thank you so much for your time.
The post.js function would fail to build as there is no package.json. If you look at the repository I shared in the post above, there is a package.json file in the repository root. Functions, like a site that uses React, Vue, etc. requires building and without package.json this won’t work properly.