问题标签 [prismic.io]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
content-management-system - 在 prismic.io admin 中可视化分层内容/分类
我正在尝试创建与此类似的分类法:
等等
可以基于分层内容的组选择创建分类,但在选择时,分层是不可见的。拥有复杂的分类法需要公开这种视觉层次结构,因为编辑器不可能记住哪些子(和子子!)类别属于哪个父级。
此外,选择类别 2.2 应自动选择类别 2。
这些有可能吗?
prismic.io - template forms in prismic
I'm new to prismic and trying to figure out if this is right tool for what I need. I need to create multiple form templates. I want prismic user to be able to build out the template, which will get loaded into gatsby where each field will get built out as components based on a title, type, action, name.
- Title will be the title or label.
- type will be the type of form element, ex: input, button, radio action,
- if its a button the action it needs to do.
- name the name for the form element.
Does prismic seem like a good candidate for this and does anyone know of any examples of how I might go about setting up the prismic end. Most of what Ive seen so far is full pages with just title and images. Not exactly forms.
In their repository I only see these options to create elements am I missing some important ones ?
- Title
- Rich Text
- Image
- Content Relationship
- Link
- Link to Media
- Date
- Timestamp
- color
- number
- key text
- Select
- Embed
- GeoPoint
- Group
How would I go about creating form elements, Is there a way to create custom objects to export? Every time I try to add a new filed or a custom object to the json editor it says. Unrecognized, property it will be ignored. I'd like to be able to use the group to group a bunch of form elements together even if they are just custom objects that I can pass custom properties to so when I load the group into React I can use the custom properties to build out my components ?? Can anyone set me straight here on if this is possible using prismic.
Thanks!
graphql - 棱镜 graphql 查询单个用户
我试图弄清楚如何通过 id 从 graphql 模式中查询单个用户。我正在使用 graphiql 工具,并且能够获取所有用户。
输出:
我在架构上也有 prismicUser()
输出:
我正在尝试根据特定 id 查询用户,但不确定我是否以错误的方式查询。我试过这个。
我收到一个错误
{ "errors": [ { "message": "Argument \"id\" has invalid value \"Prismic__User__WzKDZywAABmiZkYp\".\n预期 \"prismicUserIdQueryString_2\",找不到对象。", "users": [ { "line ": 25, "列": 23 } ] } ] }
如何根据他们的 id 呼叫特定用户?
graphql - 如何查询棱镜切片并从每个切片返回数据
我正在尝试使用 Gatsby 的 /___graphq 调试器和gatsby-source-prismic的 README 文件说你可以返回切片。所以下面我将返回一个名称为 PrismicProductBodySteps 的切片。
有人可以向我解释... on PrismicProductBodySteps 是什么意思吗?
在 gatsby 组件中,我将其视为示例。
谁能向我解释 ...ProductStepsFragment 的含义?
graphql - 使用来自数据对象的变量的 GraphQL 查询
我有一个 graphQl 查询,我使用 Prismic uid 来获取特定用户。现在我还想从另一个名为 prismicSpaces 的 prismic 数据集中获取用户空间,但我不想根据 prismicSpaces 上的 uid 查找数据,而是想从 prismicUsers 数据对象中传递一个名为 location_id 的标识符。看到 location_id 不像 uid 那样位于根目录,我该如何使用它来将其传递给 prismicSpaces ?
下面是我当前的查询,效果很好,但我需要一种方法来传递 location_id,就像下面的第二个示例一样。
附言。我正在使用 gatsby 和 prismic
示例,但这不起作用。
javascript - Prismic - 如何在不暴露访问令牌的情况下进行 API 调用
我正在构建一个 vue js Web 应用程序,我想分别调用我的 prismic repo,但我不知道如何在不暴露我的访问令牌的情况下做到这一点。我正在使用此处显示的其余 api 方法。有任何想法吗?
http请求语法如下。我想在我的 vue 组件中执行此操作,同时不暴露 access_token。
http://your-repository-name.prismic.io/api/v2/documents/search?ref=Your_Ref&access_token=Your_Token
在我的 API/安全设置中,我还获得了客户端 ID 和客户端密码。我也不知道如何使用这些。
谢谢
javascript - 带有graphql-yoga的子字段上的Graphql错误
我正在尝试通过另一个 graphql API 的代理查询一个 graphql API 并且收到一个错误。我正在为我的服务器使用 graphql yoga 并从 CMS 连接到另一个 graphql API。这是我的代码:
服务器.js
下面是我在 Graphql Yoga 附带的 graphql playground 上的查询:
我收到的错误是:
'查询未通过验证。违规:\n\n\'Json\' 类型的字段 \'page_title\' 不得有子选择。(第 3 行,第 5 列):\n page_title {\n ^' } },
奇怪的是,如果我在没有嵌套text
字段的情况下对查询进行硬编码,因为服务器上的错误提示如下:
尝试在 graphql 操场中修改我的查询以不包含嵌套text
字段,如下所示:
给我以下错误,根本不允许我提出请求:
“[TextField]”类型的字段“page_title”必须有一个子字段选择。您的意思是“page_title { ... }”吗?
该错误表明我需要添加text
预期的嵌套子字段,但是当我使用此查询而不是服务器上的硬编码查询时,它会给我前面提到的错误。
不确定我的设置是否有问题?
谢谢
javascript - react const中的目标片段
我正在构建我的第一个反应站点,使用带有 prismic.io 的 gatsby 作为我的新闻部分的 CMS。
在 prismic 中,我在每个新闻报道中使用切片作为引用和特色图片,并希望尝试将这些数据提取到我的页面中,但是我不确定如何定位我在相关const
内容中创建的特定片段名称已为每个设置。
GraphQL 查询
定位常量
featured_image
由于切片在 prismic 中是可选的,因此当在 a之前添加 a时,我遇到了一些新闻报道的问题quote
,使它们在body
.
问题
每个内部是否有const
针对特定片段的方法,或者我有更好的方法来做到这一点?
reactjs - 无法访问 Gatsby 页面查询中的对象数据
我正在为一个网站使用 Prismic 和 Gatsby,但在使用页面模板时遇到了问题。graphql 查询有效,但我无法访问数据对象中的项目。
这就是我的模板的设置方式:
我可以记录查询对象并且存在所有正确的信息,但无论出于何种原因,我都无法访问对象中的数据。
如果我将组件更改为:
我可以“进一步”进入对象,但data.title.text
最终使用TypeError: data.title is undefined
删除缓存和重建查询似乎没有帮助,当我使用 graphql explorer 时,我的 graphql 查询没有问题。我希望我错过了一些基本的东西,但我无法终生找出问题所在。
vue.js - v-for 中的 PrismicDOM.RichText
把这个问题改写为不清楚。
我正在使用 Prismic,并且我已经能够在我的 Nuxt 项目中使用 prismic-javascript 在页面上提取博客文章。
这就是我目前所拥有的:
但是,我不确定如何将 Prismic RichText 渲染字符串放入 v-for,如下所示:
我可以在 v-for 之外执行此操作,创建一个变量,即使 - 这可能是一个单独的问题- 我将所有 html 呈现为普通文本,而不是标签。
我遵循了这个“教程”,但我也没有从博客中获得更新的内容,尽管 async/await (也许我也错过了一些东西)
这是获取帖子的其余代码:
}
感谢您的回答,希望它也可以对其他人有所帮助/澄清。