Giter Club home page Giter Club logo

datocms-astro-blog-demo's Introduction

A Blog example using Astro and DatoCMS

This example showcases an Astro Blog using DatoCMS as the data source. The purpose of this repo is to have a quick start reference that can be set up with the "one-click" button below.

Demo

Have a look at the end result live:

How to use

Quick start

  1. Create an account on DatoCMS.

  2. Make sure that you have set up the Github integration on Vercel.

  3. Let DatoCMS set everything up for you clicking this button:

Deploy with DatoCMS

Local setup

Once the setup of the project and repo is done, clone the repo locally.

Set up environment variables

In your DatoCMS' project, go to the Settings menu at the top and click API tokens.

Then click Read-only API token and copy the token.

Next, create the .env with your API token (which will be ignored by Git):

echo ASTRO_EXAMPLE_CMS_DATOCMS_API_TOKEN=<YOUR_API_TOKEN> >> .env

Run your project locally

npm install
npm run dev

Your blog should be up and running on http://localhost:3000!

client:visible directive

Astro is "Zero JS, by default: No JavaScript runtime overhead to slow you down". That means that by default Astro generates static files server-side and no JS is sent to the client, unless strictly needed.

When using the <Image /> component, or any other component that requires some client-side orchestration, you must instruct Astro to send the component bundle to the client, so that the interactive features can be made available to the user. Astro uses directives: client:visible loads and hydrates the component once the component has entered the user’s viewport.

In this demo, we use the client:visible directive to enable the lazy load of images, that are actually loaded only when they enter the viewport.

datocms-astro-blog-demo's People

Contributors

marcelofinamorvieira avatar sistrall avatar stefanoverna avatar reubence avatar

Watchers

Ben avatar  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.