type
status
date
slug
summary
tags
category
password
icon
本文会给大家介绍如何在WordPress上安装一个插件,实现将notion上写的文章自动同步到WordPress上,从而提高写作效率,接下来请跟随我的脚步一起来操作吧!
![notion image](https://img.techins.xyz/techins/2023/12/fc1b038c9f94ec16fd357b50fcd91a26.png?t=abee530e-9eb7-4145-bcc2-a8da7bacb479)
一、插件安装
在WordPress后台添加新插件页面中搜索“notion”,选择如下图红框勾选的插件“WP Sync for Notion”进行安装。
![notion image](https://img.techins.xyz/techins/2023/12/6dcb074715b61e21a48a945719459459.png?t=a401180a-f573-42bc-832b-a762efbfb1d0)
插件安装成功后,需要分别在notion平台和这个插件上做一些配置操作,接下来会详细介绍给大家。
二、插件配置
2.1 notion配置过程
在浏览器打开notion页面,登录成功后,选择左上角的设置选项
![notion image](https://img.techins.xyz/techins/2023/12/f63d383d35cf3b75eb68b6ef53e2c8b8.png?t=392a8324-d6f3-4cb7-9bf4-23a1035e2f11)
然后选择“Connections”选项中的“Develop or manage integrations”,会打开一个新页面。
![notion image](https://img.techins.xyz/techins/2023/12/865fa5863dc524e523ff261f99a6cf94.png?t=b6a6b9e7-f34d-4dd6-b67f-019be081d059)
在新页面上选择“new integration”,创建一个notion集成。
![notion image](https://img.techins.xyz/techins/2023/12/f9dbdf4f9c92d982f4e15a5580b14984.png?t=59e4a764-a290-46eb-894e-dd7d71d52ec3)
填写一些集成应用的基础信息,给它命个名,如我这里的“notion to techins”,也可以再上传一个icon,让你的集成看上去更专业。
![notion image](https://img.techins.xyz/techins/2023/12/5bd7dadcf95ddfb44b24dd64a99e691f.png?t=4b2a2b7a-0ea4-4e1e-970f-a43ec70bfd28)
信息填写完成后,点击Submit提交,这个集成就创建好了。这里可以把页面上的Secret复制下,在WordPress插件中需要用到。
![notion image](https://img.techins.xyz/techins/2023/12/dd62be6a991f5a8a084a6b5e31af0ac8.png?t=571e7cff-ac9f-45bd-99f8-894c5122a4b6)
为了后续验证同步效果,接下来我在notion中创建了一个页面“已发布”,并在下面创建了两个子页面,如下图所示。
![notion image](https://img.techins.xyz/techins/2023/12/7254d16ad74c3ed618b66056aef7cf2e.png?t=7468abd6-8f3e-4042-bf8c-055f329f611d)
选中“已发布”页面,点击页面右上角的“…”设置图标,往下滚动选择“Add connections”,搜索notion就出来了我们之前创建的“notion to techins”这个集成。
![notion image](https://img.techins.xyz/techins/2023/12/97daa241db936c0e6cd5adc13131a748.png?t=72a2b79c-46af-4a10-89f6-c2517399b11c)
点击confirm安装和启用这个集成。
![notion image](https://img.techins.xyz/techins/2023/12/d36100b5f4bfd5d06041c0ec35c7567d.png?t=201ee4b0-e515-4c89-be5f-d4a96ccf6f27)
到这里notion这边的配置就搞完了。
2.2 同步插件配置过程
接下来回到WordPress插件管理页面,启用刚才安装的插件,会在WordPress侧边栏出现该插件选项,进入该插件管理页面,点击“Add New”创建一个新的同步连接。
![notion image](https://img.techins.xyz/techins/2023/12/5c7b0ccf2202d2b426b680c06b7d0f5e.png?t=46fcb450-c65a-44b6-b89a-392f78410688)
给这个连接起一个名字,把notion中创建的Secret拷贝到token输入框中,选择“Yes”按钮,确认token信息。
![notion image](https://img.techins.xyz/techins/2023/12/5424d477d581aed7bf6571b7447a5551.png?t=141766e8-b75c-4b7d-a731-157186b5acc4)
接下来可以在Choose选项中根据页面标题进行搜索,需要输入至少3个字进行匹配,这里搜索的文章范围就是我们在notion平台配置集成的页面及其子页面。
![notion image](https://img.techins.xyz/techins/2023/12/decd3727dde18a2392e4bcad127bf32d.png?t=ce6bc171-b9a5-4921-b736-97450b5ec9a4)
我这里选择的是“已发布”页面,按照我之前在notion中的页面结构,相当于选择了一个父目录,并且在“Include children’s pages”中点选了Yes,看下是否可以帮我把下面的子页面一起同步过来。
![notion image](https://img.techins.xyz/techins/2023/12/982631ce8f9c37f835d3961d7ddc657c.png?t=d05c4b96-4cf6-4431-855a-a1df5c9de1dd)
下面还有一些导入选项,大家可以根据自己的情况设置,如我把Post Status选了草稿,意思是导入过来的文章是草稿状态,不要直接发布。
![notion image](https://img.techins.xyz/techins/2023/12/e7173aec9944a918715a0445aae6e6f9.png?t=b9bde5c7-cafc-43e7-b9f6-441f494bef05)
默认是免费版,可以选择手动同步和周期性同步,大家可以按需选择。
![notion image](https://img.techins.xyz/techins/2023/12/9d9a9360996a064b61f2287151d1b638.png?t=cd5ea871-5d1a-4037-b309-0d4a6a973e86)
上面的配置填写完成后,可以点击页面右侧的“发布”按钮,发布这个Connection。
![notion image](https://img.techins.xyz/techins/2023/12/780b4acbdc9681a96aea7caf84adbd0f.png?t=faa9a454-53a1-4355-9f51-9cc713fe0062)
发布完成后,可以点击Actions框中的“Sync now”按钮触发立即同步操作。
![notion image](https://img.techins.xyz/techins/2023/12/c10f8f7b6d894660978491cbfec46daa.png?t=2383fb72-dd13-438b-a7f8-f8da2d90bc94)
如果一切顺利,稍等一小下就可以看到Successful的提示啦!
![notion image](https://img.techins.xyz/techins/2023/12/eaf08a8a1a9f838afb2e9d75d6bb10b7.png?t=92a6abb2-ed0b-4dbe-ab7c-c36df7fce5b3)
可以去“所有文章”页面查看文章记录,可以发现插件已经把我们在notion中创作的父页面及其子页面都同步过来了,并且是作为草稿状态进行存储的,非常nice!
![notion image](https://img.techins.xyz/techins/2023/12/d01e5b74a0b45a3e03f8b06c5cea0bdf.png?t=8b2175ca-839b-445b-b754-3a51a0d63ca1)
三、常见问题
我在安装插件后碰到一个问题,就是点击同步后,一直是如下In progress的状态。如果你也碰到了这个问题,并且你的域名是托管在cloudflare上的,那么大概率可以参考下面的解决方案。
![notion image](https://img.techins.xyz/techins/2023/12/2e1418f1ee1a8917f054230e90f82fae.png?t=cfb83c72-a9cf-4539-9315-09b28fb7bbf7)
可以去cloudflare看下防火墙事件,看下同步请求是否被拦截,可以看下拦截记录中的IP地址是否是你的服务器IP。
![notion image](https://img.techins.xyz/techins/2023/12/99722653c3b67e6730309d0113609c20.png?t=e12f8898-08a2-41b5-b733-7b2ab0f29098)
如果是被cloudflare拦截了,可以在cloudflare控制台的WAF页面中,选择“工具”tab,将你服务器的IP地址加入到白名单中,如下图所示,添加完成后重新去WordPress后台点击“Sync now”应该就可以顺利同步啦!快去试试吧~
![notion image](https://img.techins.xyz/techins/2023/12/43d4431f878d7f2e113acc5cc75b6a9e.png?t=836f0ceb-e9ff-4122-9ea4-52a1eb6cf771)
- 作者:夏夜
- 链接:https://techins.xyz/sync-notion-to-wordpress
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。