告别繁琐,拥抱自由:使用 Sanity.io 轻松搭建你的现代化博客

对于许多开发者来说,拥有一个属于自己的博客是分享知识、记录成长的最佳方式。比如说我在掘金上发的文章,刀乐都让掘金赚了,搭建一个博客有助于提升我们程序员的影响力。

今天,我们将介绍一个解决方案:使用 Sanity.io 这个 Headless CMS,结合前端框架 SolidStart,来构建一个属于你自己的博客。

先看看Demo

什么是 Sanity.io?

Sanity.io 是一个现代化的、可定制的 Headless 内容管理系统(CMS)。就是说它提供可视化管理端来管理我们数据库的东西。这意味着你可以使用任何你喜欢的前端技术(如 Next.js, React, Vue 等)来构建你的网站或应用,并通过 API 从 Sanity 获取内容。
Sanity 的主要优势包括:

  • 高度灵活的内容建模:你可以通过简单的 JavaScript 对象来定义你想要的内容结构(Schema),完全掌控你的数据模型,如下我定义了一个作者表
import {
   
   defineField, defineType} from 'sanity'

export default defineType({
   
   
  name: 'author',
  title: 'Author',
  type: 'document',
  fields: [
    defineField({
   
   
      name: 'name',
      title: 'Name',
      type: 'string',
    }),
    defineField({
   
   
      name: 'slug',
      title: 'Slug',
      type: 'slug',
      options: {
   
   
        source: 'name',
        maxLength: 96,
      },
    }),
    defineField({
   
   
      name: 'image',
      title: 'Image',
      type: 'image',
      options: {
   
   
        hotspot: true,
      },
    }),
    defineField({
   
   
      name: 'bio',
      title: 'Bio',
      type: 'array',
      of: [
        {
   
   
          title: 'Block',
          type: 'block',
          styles: [{
   
   title: 'Normal', value: 'normal'}],
          lists: [],
        
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值