一、背景
为了满足 SEO 类型插件接入,需提供通过搜索引擎优化功能快速更新 TDK 的能力,在以下范围内开放相关能力:
1. 页面范围:分类页、商品页、博客文章、博客集合页、自定义页面
2. 接口类型:新增、更新
3. 字段及功能:
-
Title:修改页面标题
-
Description:调整页面 Meta Description
-
Keywords:调整页面 Meta Keywords
二、对接方式
1. 接口文档
- 查询资源下的元字段
- 通过元字段进行创建/更新
2. 字段说明
-
namespace :seo 保持不变即可
-
type :single_line_text_field 保持不变即可
-
key:
-
-
seoTitle 对应 SEO 中的 Title
-
seoDescription 对应 SEO 中的 Description
-
seoKeyword 对应 SEO 中的 Keywords
-
-
owner_resource: 所属资源类型
-
-
products:商品 -
collections:商品分类 -
pages:页面 -
blogs:博客集合 -
articles:博客
-
-
owner_id: 资源的 id,如
products类型的资源 id 为对应商品的 id -
value:具体的值
{
"metafields": [
{
"value": "seoTitle",
"owner_id": "16070648133130251501392795",
"owner_resource": "products",
"type": "single_line_text_field",
"namespace": "seo",
"key": "seoTitle"
},
{
"value": "seoDescription",
"owner_id": "16070648133130251501392795",
"owner_resource": "products",
"type": "single_line_text_field",
"namespace": "seo",
"key": "seoDescription"
},
{
"value": "seoKeyword,seoKeyword1,seoKeyword2,seoKeyword3",
"owner_id": "16070648133130251501392795",
"owner_resource": "products",
"type": "single_line_text_field",
"namespace": "seo",
"key": "seoKeyword"
}
]
}
3. 资源 id 获取
a. 商品
b. 分类
- 手动分类
- 智能分类