Creating and sharing anchor URLs

This is awesome, thanks for sharing the info. I’m not sure if this helps anyone, but I felt uncomfortable with user/visitors being able to access any hashtags based on naming.

This is how I’m avoiding it. There might be a better way but this seems to work for me :slight_smile:

    const allowedAnchors = ["allowedID", "anotherAllowedID"]; // Add more as needed

    // Get the anchor from the URL
    const anchor = wixLocation.url.split('#')[1];

    // Check if the anchor is in the allowed list
    if (allowedAnchors.includes(anchor)) {
        // Scroll to the specific anchor if it's one of the allowed strings
        $w('#' + anchor).scrollTo();
    }