用Obsidian digital garden插件发布笔记

如题所示,这个插件名为 Obsidian Digital Garden,用于在网上发表自己的笔记,可以看做是官方Publish功能的一个替代吧。

使用过一些静态博客生成工具,也用过Obsidian中其他的publish插件,目前来说这个插件是最为合适我的。它比传统的博客工具和其他插件更强大一些,比如支持embedded/transcluded页面,支持excalidraw,支持callout。它比传统的博客工具也更加纯粹,没有评论系统,没有花里胡哨的页面(当然能力足够的人当然可以自己写出一个炫酷的界面),因此更适合分享笔记。

具体的效果可以参考我个人的网站,hxhc-notes,也给我的博客打个广告哈哈哈。由于我部署在netlify上,速度会比较慢,以后有机会重新换一个快一点的平台吧。

为什么要用该插件呢?

  1. 免费,最重要的一点
  2. 支持多种语法和Dataview(不支持dataviewjs)
  3. 支持嵌入/transcluded(不知道该如何翻译) excalidraw
  4. 可选任意社区主题
  5. 支持支持mathjax、mermaid、PlantUML等
  6. 支持graph view
  7. 生成github仓库后可以自己选择发布平台,如netlify,vercel或其他国内平台

不足之处

1. 不支持graph view (新版本已支持local graph)
2. 部分功能仍不完善
3. 界面较为简陋(虽然我个人觉得是优点)
4. 默认使用的netlify平台在国内访问速度感人,vercel最近也被墙了(我的网页访问较慢,但其他人的也挺快,不知道是不是我哪里没设置好)

这个插件刚出来的时候就使用了,前段时间也一直在关注开发进度,现在我感觉已经足够使用了。开发者很热心回复,很多issue都在用心解决,比如可以使用任意社区主题,自定义网页的favicon,支持dataview等就是我提议的。

我个人的用途其实比较简单,分享一点自己学习笔记,当然也可以把它作为博客分享,所以我只需要一些基本功能就可以。比较遗憾的是,Obsidian的graph view不支持,虽然我本来也不用这个,但应该对许多人都有用吧。 新版本已支持local graph。

另一点就是使用这个插件需要一点点的编程基础,或者说是英文基础。只要按照作者说的指南一步一步去做,应该是没有问题的,甚至只需要点鼠标就可以了。

其实在国内最大的问题还是访问速度,国外一些免费的平台,如netlify、vercel、cloudflare page,在国内的访问速度都比较感人,像vercel最近还有dns污染,根本无法访问。但是如果你的域名备份过,可以选择国内平台。

适合的人

说了一大堆没什么逻辑话,最关键的还没说。
这个插件适用于想体验Obsidian官方Publish服务,但又不愿支付略显昂贵的价格的人。‘’:rofl:

7 个赞

体验了一下,只打开了楼主主页,很简洁,里面的链接打不开了,速度确实感人。。。

因为vercel在很多地方被dns污染了 :rofl:
其实如果你的域名备份过,可以使用国内厂家(比如腾讯)的服务。我的域名没有备份,所以就用不了,只能挂在国外厂商的免费服务上。

个人测试下来,发现访问速度慢似乎不完全是netlify的锅。我用这个方案、和 oldwinter数字花园的jekyll方案分别在netlify上进行了部署。访问速度差异较大。不过后者不支持callout等更多ob功能。

插件方案: https://kylisss.netlify.app
jekyll方案: https://dg.eze.is

可以看下试试

感谢分享,过两天试一下。这个速度确实非常快,而且更加美观强大

1 个赞

老大,我使用了一下,好像第一次发布以后,如果后面在obsidian上更新、发布了,github上也更新了,但在netlify上没法刷新,不知道为什么?请教大神

这个不应该啊,github上更新后,是会触发netlify自动重新构建的。是不是需要清一下浏览器缓存?

按照作者的文档一步一步来,部署成功了,但后续添加笔记再push的时候netlify那边出现了一些问题,然后再写新笔记就push不过去了。

如图


4:14:49 PM: Build ready to start
4:14:51 PM: build-image version: d05976bd3309b73a86eaa327bf80e105ff13f5e4 (focal)
4:14:51 PM: build-image tag: v4.13.0
4:14:51 PM: buildbot version: 3a000de5d3727998f3297394596d287d7e49aecd
4:14:51 PM: Fetching cached dependencies
4:14:52 PM: Starting to download cache of 99.6MB
4:14:52 PM: Finished downloading cache in 981.054526ms
4:14:52 PM: Starting to extract cache
4:14:53 PM: Finished extracting cache in 845.570336ms
4:14:53 PM: Finished fetching cache in 1.865092165s
4:14:53 PM: Starting to prepare the repo for build
4:14:53 PM: Preparing Git Reference refs/heads/main
4:14:54 PM: Parsing package.json dependencies
4:14:55 PM: Starting build script
4:14:55 PM: Installing dependencies
4:14:55 PM: Python version set to 2.7
4:14:56 PM: Started restoring cached node version
4:14:56 PM: Finished restoring cached node version
4:14:57 PM: v16.18.0 is already installed.
4:14:57 PM: Now using node v16.18.0 (npm v8.19.2)
4:14:57 PM: Enabling node corepack
4:14:57 PM: Started restoring cached build plugins
4:14:57 PM: Finished restoring cached build plugins
4:14:57 PM: Attempting ruby version 2.7.2, read from environment
4:14:58 PM: Using ruby version 2.7.2
4:14:58 PM: Using PHP version 8.0
4:14:58 PM: No npm workspaces detected
4:14:58 PM: Started restoring cached node modules
4:14:58 PM: Finished restoring cached node modules
4:14:59 PM: Started restoring cached go cache
4:14:59 PM: Finished restoring cached go cache
4:14:59 PM: Installing Go version 1.17 (requested 1.17)
4:15:03 PM: unset GOOS;
4:15:03 PM: unset GOARCH;
4:15:03 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
4:15:03 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
4:15:03 PM: go version >&2;
4:15:03 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
4:15:03 PM: go version go1.17 linux/amd64
4:15:03 PM: Installing missing commands
4:15:03 PM: Verify run directory
4:15:04 PM: ​
4:15:04 PM: ────────────────────────────────────────────────────────────────
4:15:04 PM:   Netlify Build                                                 
4:15:04 PM: ────────────────────────────────────────────────────────────────
4:15:04 PM: ​
4:15:04 PM: ❯ Version
4:15:04 PM:   @netlify/build 27.20.6
4:15:04 PM: ​
4:15:04 PM: ❯ Flags
4:15:04 PM:   baseRelDir: true
4:15:04 PM:   buildId: 6351031505117a0008738717
4:15:04 PM:   deployId: 6351031505117a0008738719
4:15:04 PM: ​
4:15:04 PM: ❯ Current directory
4:15:04 PM:   /opt/build/repo
4:15:04 PM: ​
4:15:04 PM: ❯ Config file
4:15:04 PM:   /opt/build/repo/netlify.toml
4:15:04 PM: ​
4:15:04 PM: ❯ Context
4:15:04 PM:   production
4:15:04 PM: ​
4:15:04 PM: ────────────────────────────────────────────────────────────────
4:15:04 PM:   1. build.command from netlify.toml                            
4:15:04 PM: ────────────────────────────────────────────────────────────────
4:15:04 PM: ​
4:15:04 PM: $ npm install && npm run build
4:15:06 PM: up to date, audited 637 packages in 2s
4:15:06 PM: 69 packages are looking for funding
4:15:06 PM:   run `npm fund` for details
4:15:06 PM: 13 vulnerabilities (5 moderate, 6 high, 2 critical)
4:15:06 PM: To address all issues, run:
4:15:06 PM:   npm audit fix
4:15:06 PM: Run `npm audit` for details.
4:15:06 PM: > [email protected] build
4:15:06 PM: > npm-run-all build:*
4:15:07 PM: > [email protected] build:eleventy
4:15:07 PM: > cross-env ELEVENTY_ENV=prod NODE_OPTIONS=--max-old-space-size=4096 eleventy
4:15:08 PM: [11ty] Problem writing Eleventy templates: (more in DEBUG output)
4:15:08 PM: [11ty] > Output conflict: multiple input files are writing to `dist/test11/index.html`. Use distinct `permalink` values to resolve this conflict.
4:15:08 PM:   1. ./src/site/notes/test11/第一篇.md
4:15:08 PM:   2. ./src/site/notes/test11/第二篇.md
4:15:08 PM: `DuplicatePermalinkOutputError` was thrown:
4:15:08 PM: [11ty]     (Repeated output has been truncated…)
4:15:08 PM:         at TemplateMap.checkForDuplicatePermalinks (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateMap.js:656:13)
4:15:08 PM:         at TemplateMap.cache (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateMap.js:365:10)
4:15:08 PM:         at processTicksAndRejections (node:internal/process/task_queues:96:5)
4:15:08 PM:         at async TemplateWriter._createTemplateMap (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateWriter.js:242:5)
4:15:08 PM:         at async TemplateWriter.generateTemplates (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateWriter.js:275:5)
4:15:08 PM:         at async TemplateWriter.write (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateWriter.js:321:23)
4:15:08 PM:         at async Eleventy.executeBuild (/opt/build/repo/node_modules/@11ty/eleventy/src/Eleventy.js:986:13)
4:15:08 PM: [11ty] Copied 1 file / Wrote 0 files in 0.79 seconds (v1.0.0)
4:15:08 PM: ERROR: "build:eleventy" exited with 1.
4:15:08 PM: ​
4:15:08 PM: ────────────────────────────────────────────────────────────────
4:15:08 PM:   "build.command" failed                                        
4:15:08 PM: ────────────────────────────────────────────────────────────────
4:15:08 PM: ​
4:15:08 PM:   Error message
4:15:08 PM:   Command failed with exit code 1: npm install && npm run build (https://ntl.fyi/exit-code-1)
4:15:08 PM: ​
4:15:08 PM:   Error location
4:15:08 PM:   In build.command from netlify.toml:
4:15:08 PM:   npm install && npm run build
4:15:08 PM: ​
4:15:08 PM:   Resolved config
4:15:08 PM:   build:
4:15:08 PM:     command: npm install && npm run build
4:15:08 PM:     commandOrigin: config
4:15:08 PM:     publish: /opt/build/repo/dist
4:15:08 PM:     publishOrigin: config
4:15:08 PM:   redirects:
4:15:08 PM:     - from: /*      status: 404      to: /404  redirectsOrigin: configCaching artifacts
4:15:08 PM: Started saving node modules
4:15:08 PM: Finished saving node modules
4:15:08 PM: Started saving build plugins
4:15:08 PM: Finished saving build plugins
4:15:08 PM: Started saving pip cache
4:15:08 PM: Finished saving pip cache
4:15:08 PM: Started saving emacs cask dependencies
4:15:08 PM: Finished saving emacs cask dependencies
4:15:08 PM: Started saving maven dependencies
4:15:08 PM: Finished saving maven dependencies
4:15:08 PM: Started saving boot dependencies
4:15:08 PM: Finished saving boot dependencies
4:15:08 PM: Started saving rust rustup cache
4:15:08 PM: Finished saving rust rustup cache
4:15:08 PM: Started saving go dependencies
4:15:08 PM: Finished saving go dependencies
4:15:08 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:15:08 PM: Creating deploy upload records
4:15:09 PM: Failing build: Failed to build site
4:15:09 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:15:09 PM: Finished processing build request in 17.323564584s

折腾半天,原来是因为:

  • 不能有中文文件夹
  • 不能有中文笔记名,netlify那边会报错。
    • 解决方法 :文件夹使用数字字母组合的名字,笔记名可以继续用中文,但要在YAML区写入 dg-permalink: “中文笔记名”
1 个赞

不好意思回复得晚了,最近没怎么上论坛。

不能用纯中文来命名笔记,因为发布出去的链接是文件夹名/笔记名的形式,但是他会把中文字符全部去掉,只留下字母。

另外最近我发现似乎选用不同的主题也会影响访问速度,我换了几个主题后,发现网页打开速度快了一些。

对的,我也是折腾时候恰好用了中文加字母和数字命名,预览网页时候发现笔记名只剩下了字母数字,才意识到原来是这个问题。后来去作者的github上看到大佬也留言问过,作者给了解决方式。

我才开始了解github,正好再问个小白问题,插件菜单最下面的site template,作者说明里提到进度条走完后会有一行链接,然后点击进入Git分支合并,我自己操作并没有出现链接,但提示成功,关于分支合并这个概念,我是一头雾水。

主题的话,大佬有推荐的么?我试了一圈,觉得everforst配色还不错,就是预览时候字体整体偏大。


点一下create PR,过一会儿会出现一个链接,你点击那个链接进去就会跳转到github的pull request界面,直接拉倒最下面,点击merge,提交就行了。我的图里是之前merge过的链接。

主题我没什么推荐的,我最爱的主题是blue topaz,但好像选这个主题以后,访问速度就变慢了。我也没有找到满意的主题。 :joy:

感谢回复,就是这个菜单下,之前读完进度后我这边没有这几行链接, 一会再去试试。

可以了竟然,搞不懂之前为什么不显示链接。

更新完了模版后,行间距也正常了,链接也更醒目了。

你用的是默认主题是吧,可以帮忙测试下markdown表格在网页上的显示效果吗?我这边看不到表格边框,感觉很奇怪 :joy:

不是,切默认测试下。


这里是表头1 这里是表头2 这里是表头3
单元格数据1 单元格数据2 单元格数据3
单元格数据4 单元格数据5 单元格数据6

代码复制教程里的,我不会写表格。

好的,谢谢。看来表格确实没有边框,我还以为是我的问题。

不谢哈,还有什么需要测试的可以@我。

插件更新了,作者说模版也更了,是不是每次模版更新都要去create PR生成新的链接然后到github里合并啊?

是的,如果需要更新模板,就要创建PR,然后自己merge下

1 个赞

出现了好多错误,无法构建网页

[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] Copied 1 file / Wrote 0 files in 0.37 seconds (v1.0.0)
"build.command" failed
4:25:39 PM:   Error message
4:25:39 PM:   Command failed with exit code 1: npm install && npm run build (https://ntl.fyi/exit-code-1)
4:25:39 PM: ​
4:25:39 PM:   Error location
4:25:39 PM:   In build.command from netlify.toml:
4:25:39 PM:   npm install && npm run build
4:25:39 PM: ​
4:25:39 PM:   Resolved config
4:25:39 PM:   build:
4:25:39 PM:     command: npm install && npm run build
4:25:39 PM:     commandOrigin: config
4:25:39 PM:     publish: /opt/build/repo/dist
4:25:39 PM:     publishOrigin: config
4:25:39 PM:   functionsDirectory: /opt/build/repo/netlify/functions
4:25:39 PM:   redirects:
4:25:39 PM:     - from: /api/*
      status: 200
      to: /.netlify/functions/:splat
    - from: /*
      status: 404
      to: /404
  redirectsOrigin: config
Caching artifacts