Giter Club home page Giter Club logo

eleventy-sanity-blog-boilerplate's Introduction

Eleventy and Sanity Blog Boilerplate

Minimal blog with Eleventy and Sanity.

This is a monorepo with a pre-configured Sanity Studio (/studio) and a very basic setup of Eleventy (/web).

Quick start

  1. npm install in the project root folder on local
  2. npm run sanity-init to reconfigure the studio with a new or existing project
  3. npm run dev to start the Studio and 11ty in watch mode
    • Sanity Studio runs on localhost:3333
    • 11ty outputs the static files in _site
  4. npm run build to build to production locally

Deploy on Netlify

You can host both the studio and the 11ty blog on Netlify as two apps. Log in to your Netlify account and add them as two separate apps with the following settings:

Studio

  • Repository: <your repository>
  • Base directory: studio
  • Build command: npm run build && cp ./netlify.toml dist
  • Publish directory: studio/dist

You have to add CORS-settings for the studio deployed on Netlify.

Web

  • Repository: <your repository>
  • Base directory: web
  • Build command: npm run build-web
  • Publish directory: web/_site

Deploy on now

The now.json has configuration for deploying both the frontend and the studio on one now deployment. The web frontend can be browsed from the root of your now domain. The Studio can be accessed on https://<your-domain>.now.sh/studio.

  1. Add a "basePath": "/studio" to sanity.json:

    "project": {
        "name": "sanity-tutorial-blog",
        "basePath": "/studio"
      },
  2. You have to add CORS-settings for the studio deployed on now.

CORS-settings for the Studio

Go to your projects API-settings on manage.sanity.io => Settings => API => CORS origins => Click "Add" => Add domain for the now deployment + Allow credentials.

or

> cd studio
> sanity cors add https://<your-domain>.now.sh`

eleventy-sanity-blog-boilerplate's People

Contributors

kmelve avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.