This is a repo using Sanity to create and manage the data for a custom links page for social media profiles you'll often see in Instagram (ex. bio.link, linktree, etc.)
- A CMS schema in Sanity to manage the content for a links page
- An example using Astro and its top-level fetch to fetch the data from Sanity
- An example of a web component built with Lit that is a completely self-contained
Watch my step-by-step tutorial on YouTube
Or
Follow the manual steps below:
- Create a repo from this template
- If you don't have the Sanity CLI already run
npm install -g @sanity/cli
- Open a terminal from root folder of the project
cd sanity
sanity install
sanity init
and follow the prompts (you will need to create a Sanity account if you haven't already)npm run graphql-deploy
- Take note of the graphql API url it outputs once finished
- Navigate to the astro folder
- Rename
.env.template
to.env
and - Replace the SANITY_PROJECT_ID value with your token ID
- Replace the SANITY_GRAPHQL_URL value with your GraphQL URL
- Navigate to the lit-component folder
- Replace the sanity url value in the
sanity-links-page.ts
file
Note: You will want to add http://localhost:3000 to your allowed CORS orgins in your Sanity project settings at https://manage.sanity.io
- Open a terminal located at the sanity folder
sanity install
sanity start
- Your studio should be running on http://localhost:3333
- Open http://localhost:3333 and copy the project ID from the Project info section
- Open a terminal located at the astro folder
npm install
npm start
- Your Astro site should be running on http://localhost:3000
npm run build
to build to production locally
- Open a terminal located at the lit-component folder
npm install
npm start
- The example page with the component should be running on http://localhost:3000