介绍
您可能已经了解过这个表情包以及 apple notes 的优越性。
那么,如果您可以将其用作 cms 来管理博客内容呢?这就是我想在我的“今天我学到了”网站上尝试的。这是最终结果 https://til.julienc.me

查询苹果笔记
我们需要一种从 apple notes 中获取笔记的方法。为此,我们将使用 anyquery,它是一个 sql 数据库,可以查询几乎任何内容,包括 apple notes。
在 https://anyquery.dev/docs/#installation 安装 anyquery安装apple notes插件:anyquery install notes
使用 sql 查询我们的笔记并将其保存为 json(在我的例子中,我的笔记位于文件夹 til 中)
anyquery -q "select name, html_body, modification_date from notes_items where folder = 'til';" --json > notes.json
您现在有一个文件notes.json,其中包含对象数组中的所有笔记。每个对象都有三个属性:
笔记名称(name)最后修改时间(modification_date)html 中的正文注释 (html_body)
例如:
[ { "name": "example", "modification_date": "2024-08-11t00:00:00z", "html_body": "example
this is an example
易优制冷机械设备网站源码1.6.9 易优制冷机械设备网站源码是基于易优cms开发,适合企业进行制冷设备展示使用。程序内核为Thinkphp5.0开发,后台简洁,为企业网站而生。 这是一套安装就能建站的程序,不定期更新程序BUG,更新网站功能。 我们提供的不仅是模板这么简单,我们还提供程序相关咨询、协助安装等服务。 默认不包含小程序插件,需要另外单独购买插件。 模板安装步骤 1、请将安装包ZIP上
0 查看详情
" }]
我们的最后一个任务是将网站连接到它
连接网站
就我个人而言,我使用 astro.js。我们的第一个任务是为每个条目生成静态路径。
为此,我可以从“../../notes.json”导入注释;并将其传递给导出函数 getstaticpaths()。我还使用 slugify 函数来确保生成的 url 有效。
// [...blog].astroimport notes from "../../notes.json";function slugify(string: string) { return string .tolowercase() .replace(/s+/g, "-") .replace(/[^a-z0-9-]/g, "");}export function getstaticpaths() { return notes.map((note) => { return { params: { blog: slugify(note.name), }, }; });}const { blog } = astro.params;const note = notes.find((note) => slugify(note.name) === blog);
生成路径后,我们需要编写一些 css 来匹配 apple notes 样式:
article.notes { color: #454545; font-size: 0.9rem; font-style: normal; font-weight: 400; line-height: normal; letter-spacing: -0.015rem; }article.notes > div:first-child > h1 { color: #de9807; margin-bottom: 0.5rem;}... truncated (retrieve the full CSS in the repository at src/styles.css)
我们现在完成了!
结论
恭喜,您现在正在使用 apple notes 作为 cms。它是一款功能强大的协作式 cms,仅受您的 icloud 存储限制限制。您可以添加图像、表格、格式化文本、代码等
以下是格式选项的示例:
https://til.julienc.me/example-of-capability
您可以通过执行以下操作将您自己的博客从 apple notes 部署到 vercel:
克隆存储库 git clone https://github.com/julien040/apple-notes-cms运行 npm install 或 pnpm install运行 chmod u+x deploy.sh运行 vercel 来初始化并连接项目运行 ./deploy.sh 构建项目并将其推送到 vercel
链接
源代码:https://github.com/julien040/apple-notes-cms
结果:https://til.julienc.me/
以上就是Apple Notes 是我的 CMS的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1490332.html
微信扫一扫
支付宝扫一扫