惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
腾讯CDC
V
V2EX
Martin Fowler
Martin Fowler
A
About on SuperTechFans
大猫的无限游戏
大猫的无限游戏
Blog — PlanetScale
Blog — PlanetScale
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
C
Check Point Blog
博客园 - 【当耐特】
Cisco Talos Blog
Cisco Talos Blog
The Hacker News
The Hacker News
K
Kaspersky official blog
Security Latest
Security Latest
H
Help Net Security
博客园_首页
美团技术团队
Spread Privacy
Spread Privacy
博客园 - 司徒正美
Hugging Face - Blog
Hugging Face - Blog
S
SegmentFault 最新的问题
G
Google Developers Blog
NISL@THU
NISL@THU
爱范儿
爱范儿
I
Intezer
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
N
News and Events Feed by Topic
P
Privacy International News Feed
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Security @ Cisco Blogs
Schneier on Security
Schneier on Security
雷峰网
雷峰网
人人都是产品经理
人人都是产品经理
V
Vulnerabilities – Threatpost
W
WeLiveSecurity
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
Hacker News: Ask HN
Hacker News: Ask HN
I
InfoQ
The Cloudflare Blog
F
Full Disclosure
SecWiki News
SecWiki News
宝玉的分享
宝玉的分享
N
Netflix TechBlog - Medium

CloudCannon Blog

Building with AI: Git-based vs headless vs traditional CMS CloudCannon + Astro: performance meets powerful content management Introducing the Astro Component Starter Introducing Jetstream — built on the Astro Component Starter Why we switched to the system font stack Redesigning CloudCannon’s docs with Diátaxis, Lume, and Pagefind Make content editing more visual: upgraded Editable Regions How Configuration Mode makes building editing interfaces easy Your hosting just got an upgrade (and a price cut) Custom testing domains for professional branding Keep your content consistent with input validation Managing multilingual content in CloudCannon Simplify team publishing with conflict resolution and domain tools Open Beta: Publishing Conflict Resolution Getting started with CloudCannon and Astro: Bookshop, components, and live editing Welcome to the CloudCannon Community! Omnichannel delivery is just marketing spin from API-based CMS companies Getting started with CloudCannon and Astro: Snippets and Collections Managing digital assets in CloudCannon: a guide to smart asset storage Understanding CloudCannon's branching workflows and Projects: a complete guide What is a static website? CloudCannon’s 2024 wrapped Getting started with CloudCannon and Astro: WYSIWYG blogging Jamstack vs. WordPress: reasons to make the change The top five static site generators for 2025 (and when to use them!) Free Jekyll themes for 2025: ten great community options Eleventy (11ty) vs. Hugo How to set up WYSIWYG editing with MkDocs Material The rise of static-first websites: why major brands are making the switch Watching your Core Web Vitals on Jamstack Understanding the difference between static, dynamic, and hybrid websites Looking for an alternative to Netlify CMS or Decap CMS? Designing components for your website editors: a CloudCannon case study Does my website look big in this? Six tips to lower your page weight Content is sacred — so own your revision history The eternal balancing act: load time vs. delay time Streamlined Headless Mode, Unified Configuration, and live data editing What is a headless CMS? Looking for a TinaCMS or Tina Cloud alternative? The ultimate guide to Hugo Sections Coming soon: Live config editing and data reloading Faster publishing workflows out now! Why information architecture matters for your website Website UX vs SEO: picking your battles Easily manage your multilingual Astro site in CloudCannon How you can optimize publishing workflows for your content team How you can optimize your CMS for SEO success How you can optimize your Content Editor for long-form articles How you can optimize your Visual Editor for page building Secure, swift, and stable: static sites for the financial sector Enhanced flexibility for teams with Custom Permissions Building static sites that scale The Inaugural 11ty International Symposium on Making Web Sites Real Good How to manage hundreds of connected websites with a Git-based headless CMS How we’re building CloudCannon for accessibility CloudCannon’s new editing improvements are here! Open Beta | New ways to collaborate on editing your websites Top 11 free Eleventy themes for 2024 Top 10 free Astro themes to use in 2024 Why choose a Git-based headless CMS over a monolithic DXP in 2024? Learning web development: a self-guided roadmap Partner Site of the Month: Blüthner Piano Centre, by Winteractive CloudCannon’s 2023 wrapup Let’s create a microblog with visual editing using Bookshop and Eleventy Update and visualize your branches with CloudCannon Projects What is a Git-based CMS and why you should use one CloudCannon secures SOC 2 certification The complete guide to growing your web development agency Automatically optimize your images with Eleventy Image and CloudCannon Share components and syndicate content with Site Mounting Partner Site of the Month: Cru Uncorked, by Ed Meehan New web component for responsive HTML tables Wrapping up HugoConf 2023 Partner Site of the Month: Van Dillen Antieke Bouwmaterialen, by Fulldev How to become a freelance web developer: a comprehensive guide Q3 2023: CloudCannon features and improvements 22 ways to deliver more value to your web development clients Partner Site of the Month: DC Gay Flag Football League, by Ed Cupaioli A new way to configure your CloudCannon sites CloudCannon — the official CMS partner of Eleventy Full CloudCannon support for Nuxt static sites Partner Site of the Month: Stadium Bike, by Insight Creative, Inc. HugoConf 2023, brought to you by CloudCannon DAM Support for Cloudflare R2 and DigitalOcean Spaces Eleventy (11ty) vs. Gatsby in 2023 – which SSG is best for you? Partner Site of the Month: Fiducian, by Croissant & Baguette Eleventy (11ty) vs. Astro How to customize CloudCannon’s Client Sharing interface Let anyone, anywhere, edit your CloudCannon sites Top 23 free Astro themes for building out-of-this-world static sites in 2023 How Jampack optimizes our Eleventy website and improves performance Astro vs. Next.js CloudCannon.com is now built with Eleventy! Out-of-this-world support for all Astro users Introducing the CloudCannon Partner Program Full CloudCannon support for Gatsby Top 10 Free SvelteKit Themes for Building Lighting-Fast Static Sites in 2023 Enhanced CloudCannon support for Next.js users Upcoming CloudCannon Interface improvements (Open Beta) Creating sites, the Jamstack way
How CloudCannon’s live editing works with Astro and Bookshop
2023-06-06 · via CloudCannon Blog

CloudCannon supports live visual editing on a wide range of static site generators, bringing intuitive composition, editing, and publishing workflows to everyone. But how do we do it? The short answer: Bookshop, our component development workflow for static websites, which we’ve just expanded to support live visual editing and page-building with Astro.

To help you integrate your existing Astro sites with Bookshop, we’ve created a new Bookshop Astro Guide as part of our documentation. Our Astro Sendit template is also a very helpful reference, as it contains an example site that’s fully integrated with Bookshop’s live visual editing.

While many Astro developers will be accustomed to creating, updating, and removing pages, components, and posts in their IDE, you (and other site users) can also complete all of these tasks within the CMS’s intuitive interface, as pictured above. With the Sendit template, we’ve also allowed users to easily edit our data files with CloudCannon’s Data Editor — meaning information like company details, navigation, footers, and theme colours, stored in .json files in data/, can be accessible and editable for all site users. 

Sendit template screenshot in CloudCannon interface

Getting started with Astro and CloudCannon Direct link to this section

Let’s first spin up a new Sendit site on CloudCannon, explore its features, and then poke around the files together. (If you’d rather, you can do this directly via GitHub.)

If you don’t already have a CloudCannon account, take a moment to create one, link your GitHub, GitLab, or Bitbucket account, and create a new Astro Sendit site from a template. Your site files will stay in your Git repo, and upon triggering any save in CloudCannon, your site will build.

Looking at our astro.config.mjs file, there’s not much to it, as you’ll see:

import { defineConfig } from 'astro/config';
import react from '@astrojs/react';
import bookshop from '@bookshop/astro-bookshop';

// https://astro.build/config
export default defineConfig({
site: 'https://top-quail.cloudvent.net/',
integrations: [bookshop(), react()]
});

We’re importing our configuration, as well as Bookshop and React, and declaring our site’s domain. This site: field is temporarily set for you, as above, but you can change this URL to the final, deployed URL of your site.

(Note that all sites built on CloudCannon receive a free preview domain with the format adjective-noun.cloudvent.net — if you don’t already have a final URL for your new Astro site you can set this to your free cloudvent.net domain.)

Separating content and layout Direct link to this section

The next thing you might notice about the files in this site is that we’ve separated our page and post content from the layout and routing information — our files in src/content/pages and src/content/blog are in Markdown format, and we’re using […slug].astro files in src/pages for routing. We also use .astro files like Layout.astro, PageLayout.astro, and PostLayout.astro in src/layouts for our layout information and SEO props, but having our content in .md files means CloudCannon can access it in our Content Editor (for WYSIWYG editing) and Visual Editor (for page building and live visual editing).

This way we can get the best of both worlds — Astro’s speed and flexibility for developers, and CloudCannon’s intuitive editing for writers, marketers, and content teams. Building our Astro site is one thing. Astro’s got that under control! But a good site — even one that builds astronomically quickly, with stellar opportunity for future additions — is only as strong as its ease of editing. Editing the pages and posts on our site — and allowing non-technical content writers and marketing teams to do so, as well as to create new content — is something else entirely.

And that’s where CloudCannon’s visual editing comes in.

How Visual Editing works on CloudCannon Direct link to this section

As I mentioned above, Sendit is preconfigured for live visual editing on all of its pages, so let’s dig into the feature and see how we’ve set it up for Sendit. In the above video, we saw visual editing in the Sendit homepage’s hero component. The component’s information is stored in two places. Its layout and styling is stored in /src/components/home/hero/hero.jsx:

import MarkdownIt from "markdown-it";
const md = new MarkdownIt({ html: true });

export default function HomeHero(block) {
return (
<section className="hero-two">
<div className="hero-two-shape"></div>
<div className="container-fluid">
<div className="row align-items-center">
<div className="col-lg-6">
<div className="hero-two-content">
<h1 className="mb-4">{block.title}</h1>
<div
className="mb-7 w-xxl-80"
...
/>

<div className="">
{block.button && (
<a
href={block.button.link}
className="btn btn-primary btn-lg"
>

{" "}
{block.button.text}{" "}
</a>
)}
</div>
</div>
</div>
<div className="col-lg-6">
<div className="hero-two-banner">
<img src={block.image} alt={block.image_alt} />
<div className="hero-two-banner-shape"></div>
</div>
</div>
</div>
</div>
</section>
);
}

During the build process (specifically, in our postbuild file), we use our open-source component development tool Bookshop to read the data and default values of our components from .yml files and turn them into inputs config for the editor. For example, here’s src/components/home/hero/hero.bookshop.yml, showing the data and default values (pre-filled text) for this hero component:

# Metadata about this component, to be used in the CMS
spec:
structures:
- content_blocks
label: Home Hero
description: Home Hero section
icon: "cottage"
tags: ["hero"]

# Defines the structure of this component, as well as the default values
blueprint:
title: Email Marketing is the Future for Growing Your Business Revenues
description: We believe that a good email marketing strategy is the key to growth. So we’re helping you grow your business with tools and resources that make email marketing easy.
image: /images/hero/hero-image-2.png
image_alt: Dashboard with reports
button:
text: Try This Free
link: /signup

# Overrides any fields in the blueprint when viewing this component in the component browser
preview:

# Any extra CloudCannon inputs configuration to apply to the blueprint
_inputs:
description:
type: markdown

You’ll see that each component has a defined blueprint, label, icon, and tags, and can include default values. The last few lines of this file add extra definitions to CloudCannon’s inputs configuration; in this case we’re setting our description block as a Markdown text area, unlike title or image_alt, which are plain single-line text inputs by default.

Connecting the dots Direct link to this section

Looking at src/layouts/PageLayout.astro below, we can see a component using the bookshop:live directive with props sourced from a frontmatter variable:

---
import Page from "@shared/page";
import Layout, { SEOProps } from "./Layout.astro";

type Props = {
frontmatter: {
title: string;
content_blocks: Array<Record<string, any>>;
seo?: SEOProps;
};
};

if (!Astro.props.frontmatter) {
throw new Error("Page frontmatter must be defined");
}
const props = Astro.props.frontmatter;
---

<Layout {...props}>
<Page bookshop:live contentBlocks={props.content_blocks} />
</Layout>

And in the front matter of our homepage, we can see that content_blocks contains the Bookshop component home/hero.

---
_schema: default
title: Home
seo:
page_description:
canonical_url:
featured_image:
featured_image_alt:
author_twitter_handle:
open_graph_type:
no_index: false
content_blocks:
- _bookshop_name: home/hero
title: Beautiful email campaigns
description: >-
With Sendit, you can quickly create beautiful rich emails that capture a
reader's attention, engage them, and convert them into customers.
image: /images/hero/hero-image-2.png
image_alt: Reports dashboard
button:
text: Try This Free
link: /signup/
...

---

When we view that page in CloudCannon’s Visual Editor, we’ll be able to interact with the component directly on the page. Clicking on the component will open up an editing panel, and our changes will render live on screen.

Global configuration with CloudCannon and Astro Direct link to this section

Bringing it all together is CloudCannon’s global configuration file, /cloudcannon.config.yml. Under collections_config at line 5 you’ll see that we can define (or change) a lot of information about our data, posts, and pages, including where content is stored, which schemas are used for posts and pages, and which editor should be enabled to edit them.

# -- truncated -- #
collections_config:
data:
path: data
disable_add: true
disable_add_folder: true
posts:
path: src/content/blog
output: true
url: "/blog/[slug]/"
_enabled_editors:
- content
- visual
add_options:
- name: Add New Post
schema: default
icon: post_add
schemas:
default:
name: New Post
path: schemas/post.md
_inputs:
title:
empty_type: string
image:
empty_type: string
image_alt:
empty_type: string
author:
empty_type: string
tags:
type: multiselect
allow_create: true
empty_type: array
pages:
path: src/content/pages
url: "/[slug]/"
output: true
icon: wysiwyg
_enabled_editors:
- visual
add_options:
- name: Add New Page
schema: default
icon: note_add
schemas:
default:
name: New Page
path: schemas/page.md
new_preview_url: "/"
paginated_collection:
path: schemas/paginated-collection.md
_inputs:
content_blocks:
empty_type: array
filter:
base: strict
# -- truncated -- #

You’ll also see that we’ve enabled the Visual Editor for pages on Sendit, but for posts we also give editors the option to use the Content Editor, which is a configurable WYSIWYG Markdown editor for distraction-free writing. (Users with higher-permission roles such as Developers and Site Owners will also be able to view files in the Source Editor.)

(If your interest is piqued by _inputs, we go into a lot more information about the _inputs configuration in our documentation, which includes a list of all available input types. We also go deep on _editables, which allow you to choose which toolbar controls are available to users in the Content Editor.)

When you’re setting up your own Astro sites on CloudCannon, you can choose which editing (and publishing) features would work best for your site users. With visual editing, branching for staging and production workflows, and top-tier support, CloudCannon’s got you covered.

Where to now? Direct link to this section

That brings us to the end of this short and sweet post — we’ve demystified some of the configuration behind our new Astro template within CloudCannon, and we’ve started to define just how CloudCannon lets you and your users interact with your site and its pages. There’s a tremendous amount of power, potential, and flexibility in Bookshop and that cloudcannon.config.yml file, and we’ve barely scratched the surface.

If you'd like to dig into more of the deep configuration options in CloudCannon, check out our documentation on using the configuration cascade, which is a set of sources containing customizable options for the editor, each with a different scope and priority. This allows you to set global defaults and where necessary, override those for specific collections or files.

If you come across any issues while you're dialling in your configuration for Astro, please reach out to us via our support team — we're here to help.