🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Questions and answers about integrating Sanity, 11ty, and Netlify for a company website rebuild.

17 replies
Last updated: Jun 30, 2021
Can anyone assist me with some questions I have?
1. Can a Sanity/11ty/Netlify site pull from 1 repo for Sanity, and another repo for 11ty?
2. If so, how do I verify that it's pulling the correct code?
3. If not, how do I test an 11ty theme a colleague created?
I'm very new to Sanity, 11ty, and Netlify. I have watched a ton of tutorials and read lots of docs, but it seems like every time I feel like I understand it, my colleague either does it differently or throws me a curve ball (or maybe I just didn't understand it like I thought I did).
Jun 30, 2021, 5:37 PM
This is totally fine. I think a lot of people hit the same issues when used to CMS’s like wordpress (that require being served together)
Sanity is headless. Your website will be querying Sanity’s API endpoints, so it doesn’t matter where your studio is deployed to (technically you don’t need to deploy your studio as you could just spin the studio up locally and manage content that way… but that isn’t really a real-world solution).

You can have your website code base and the studio code base in different repos.

You’ll need to set up two websites on Netlify. One for the website, one for the studio. So you just need to connect each of those sites to their respective repos.
Jun 30, 2021, 5:59 PM
So for a little background, having it run locally for testing purposes is definitely fine with me - but we will eventually have the studio site so that our content managers can go in and make edits.
For my test site (in Netlify) I have the studio site (stevey-test-site-studio), and the website (stevey-test-site). Neither of these have properly deployed in a while, as there is a failure somewhere.

Then, I have my two repos - stevey-test-site and 11ty-theme. From my understanding, the "web" folder in my stevey-test-site contains the 11ty info and the "studio" folder contains the Sanity info. Is that correct?
Jun 30, 2021, 6:07 PM
Yeah, that’s it
Jun 30, 2021, 6:08 PM
Even though that’s how they show you in the demos - That isn’t the only way you have to work
Jun 30, 2021, 6:09 PM
ok, so how can I verify that? My colleague made changes to the 11ty-theme repo, and I am not seeing that populate when I am looking at my files or site in the browser
Jun 30, 2021, 6:10 PM
so having a repos, say
and deploying each to their own netlify site would work exactly the same
Jun 30, 2021, 6:10 PM
I don’t know what this ‘11ty-theme’ repo is
Jun 30, 2021, 6:11 PM
oh, ok
Jun 30, 2021, 6:11 PM
are your ‘web’ repos
I think that is in issue unrelated to Sanity’s integration with 11ty really and more an development choice between your colleague and yourself as to how you want to build an 11ty site
Jun 30, 2021, 6:13 PM
personally, I’ve never heard of a 11ty ‘theme’ - I’ve heard of 11ty ‘Starters’ but not themes.
Jun 30, 2021, 6:15 PM
ok, so the reason I am asking all of this is because we are rebuilding our company's website using Sanity as our CMS and 11ty as our site (obviously).. so, we are in the process of setting up and creating widgets in an npm package so that our content managers can build out pages the way they want.
But I don't have a lot of experience with these two (sanity and 11ty), so I don't really know how they talk to each other and if the code I am writing even makes sense. So I tried to build a test site to see how it all worked together, but I am getting nowhere. And honestly, I am not sure any of this makes sense, ha
Jun 30, 2021, 6:20 PM
Think of the Sanity Studio as a totally separate thing - Nothing to do with your website.
All you want to be doing with the website is using Sanity as a data source for your website, and how you ingest that data into at 11ty depends on multiple factors (such as templating language etc. etc.) so there isn’t really a single answer here.
Jun 30, 2021, 6:26 PM
This post here really does break down the basics of how to query the sanity content for an 11ty site: https://www.bryanleetc.com/adding-sanity-io-headless-cms-to-eleventy/
Jun 30, 2021, 6:28 PM
hmm ok, I must have had a misunderstanding somewhere along the way that really sent me down the wrong path. Sounds like I need to take a step back and re-think this. That link you shared looks like a great place to start - thank you so much
Jun 30, 2021, 6:29 PM
yeah - sanity is just a data source, how you build the 11ty site is completely up to you, but it is quite simple to do basic content queries (it just gets a little more complicated when you start getting into serializers and things)
Jun 30, 2021, 6:31 PM
user T
has some great articles about that might be useful too
Jun 30, 2021, 6:32 PM
user F
thanks for all the answers in here.

user P
, Not sure if this will be helpful, but a good change in thinking that I went through when I dove into 11ty was to think of it as a way of taking data sources (markdown files, data from APIs, content from a headless content platform) and taking multiple templates (markdown, nunjucks, liquid, etc.) and pairing them up to create the HTML pages that get served.
Paul's right that I have done some writing around this.

You can see some guides here:
(I highly recommend the "How to get started with the 11ty blog starter. It starts with the install and then helps you add a little extra data pulled from Sanity into 11ty to get a feel for it).
Jun 30, 2021, 6:41 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?