- A+
所属分类:SEO相关
常用JSON-LD Schema代码存档
WordPress有许多设置schema的插件,大部分都是一个很大的SEO插件,而且捆绑许多很鸡肋的功能。自动描述,自动关键字,301,404等本来都可以通过主题实现,只是为不同格式的文章添加schema,还是直接修改主题文件即可。
有独立页面模板的,直接修改对应模板文件,默认页面、文章文件为page.php
和single.php/post.php
。不同形式或分类下的文章如果需要加载不同类型的schema,用自定义字段或者修改文章meta实现。begin主题通过修改Meta实现。
常用JSON-LD Schema格式模板如下,留此备份。
个人(或机构)博客文章
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type":"BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://google.com/article"
},
"headline": "文章标题",
"image": [
"图一URL",
"图二URL",
"图三URL"
],
"datePublished": "2012-03-03",
"dateModified": "2019-01-22",
"author": {
"@type": "Person",
"name": "作者名"
},
"publisher": {
"@type": "Person",
"name": "品牌或公司名称",
"logo": {
"@type": "ImageObject",
"url": "https://www.domain.com/logo.png"
}
},
"description": "文章描述"
}
</script>
个人(或机构)新闻文章
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type":"NewsArticle",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "https://google.com/article"
},
"headline": "文章标题",
"image": [
"图一URL",
"图二URL",
"图三URL"
],
"datePublished": "2012-03-03",
"dateModified": "2019-01-22",
"author": {
"@type": "Organization",
"name": "机构名称"
},
"publisher": {
"@type": "Organization",
"name": "品牌或公司名称",
"logo": {
"@type": "ImageObject",
"url": "https://www.domain.com/logo.png"
}
},
"description": "文章描述"
}
</script>
课程
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type":"Course",
"name":"课程名称",
"description":"课程描述",
"provider":{
"@type":"Organization",
"name":"课程提供者",
"sameAs":"课程URL地址"
}
}
</script>
课程详细版
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Course",
"name": "Basic Proofreading",
"description": "The distance learning training course that takes you \r\n from complete beginner to PQB qualified proofreader in one step.",
"hasCourseInstance": [
{
"@type": "CourseInstance",
"courseMode": [
"distance learning",
"Online"
],
"offers": {
"@type": "Offer",
"price": "395",
"priceCurrency": "GBP"
}
},
{
"@type": "CourseInstance",
"courseMode": [
"Posted",
"distance learning"
],
"offers": {
"@type": "Offer",
"price": "440",
"priceCurrency": "GBP"
}
}
]
}
</script>
网站Logo
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type":"Organization",
"url":"https://www.domain.com",
"logo":"https://www.domain.com/logo.png"
}
</script>
个人(或机构)社交媒体资料
<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type":"Person",
"@id":"https://www.homepage.com/#organization",
"name":"个人或机构姓名",
"url":"https://www.homepage.com",
"sameAs" :[
"https://www.facebook.com/abc",
"https://www.twitter.com/abc",
"",
"",
"",
"",
"",
""
]
}
</script>
网站
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "WebSite",
"url": "http://example.com/",
"potentialAction": {
"@type": "SearchAction",
"target": "http://example.com/search?&q={query}",
"query": "required"
}
}
</script>
独角兽驿站
公众号