我正在制作一个基于 Gatsby 的网站,我目前正在尝试在 NetlifyCMS 中添加一个自定义组件。这是 fontawesome 小部件,但由于 netlifycms 文档,我尝试添加它,但它仍然无法正常工作。
我这样做了:
(在静态/管理员/cms.js 中)
import * as FontawesomeWidget from "netlify-cms-widget-fontawesome";
CMS.registerWidget(
"fontawesome",
FontawesomeWidget.Solid,
FontawesomeWidget.Preview
);
(在静态/管理员/index.html 中)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Content Manager</title>
</head>
<body>
<!-- Include the script that builds the page and powers Netlify CMS -->
<script src="https://unpkg.com/netlify-cms@^2.0.0/dist/netlify-cms.js"></script>
<script src="./cms.js"></script>
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
</body>
</html>
我应该让我的组件在 CMS 中工作,但我有这个错误:
No control for widget 'fontawesome'.
你知道如何解决这个问题吗?