Showing a JSON file at a specific URL in Gatsbyjs

247 Views Asked by At

I'm trying to link my iOS App to a Gatsby website but I can't find how to show the following JSON file at a specific URL in my Gatsby website

I've added the JSON file inside my Static Folder

VsCode Folders Screen Shot

{
    "applinks":{
       "apps":[
          
       ],
       "details":[
          {
             "appID":"XXX.com.XXX.XXXX",
             "paths":[
                "*"
             ]
          }
       ]
    },
    "webcredentials":{
       "apps":[
          "XXXX.com.XXXX.XXXXX"
       ]
    }
 }

and I would now like it to show it up at this URL : mydomain.org/.well-known/apple-app-site-association

2

There are 2 best solutions below

0
Ferran Buireu On

The file should be at:

https://example.com/.well-known/apple-app-site-association.json

According to the structure of the static folder.

Because Gatsby clones the internal structure, and because the file it's a JSON extension (.json) the internal folder structure of the static folder becomes the path of the file.

0
Godofsleepy On

You can use static folder to add static file, here the steps

  • Add static folder on root project (inline with package.json)
  • Inside it add folder .well-known and your json file in it
  • then you can open it by "base url"/.well-known/assetlinks.json enter image description here