Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法解析的数据化结构 #745

Open
2 of 6 tasks
widsnoy opened this issue Apr 3, 2020 · 4 comments
Open
2 of 6 tasks

无法解析的数据化结构 #745

widsnoy opened this issue Apr 3, 2020 · 4 comments

Comments

@widsnoy
Copy link

widsnoy commented Apr 3, 2020

I certify that I have first consulted (check all with "x")

我确认我已经查看了 (使用 "x" 选择)


I'm submitting a (check one with "x")

我正在申请 (使用 "x" 选择)

  • bug report | 反馈一个 bug

  • feature request | 申请添加新的特性或功能

  • support request | 请求技术支持

网址检查提示无法解析的数据化结构。
Screenshot_20200403_171104.png
其中一篇文章

@Shen-LiPing
Copy link

你要不看看layout/partial/structured-data.ejs 这个文件和作者提供的原始文件有没有出入。

@RiverKy
Copy link

RiverKy commented Jul 1, 2020

相同的错误:
image

@glennwu97 文件没问题啊🤣
image

@RiverKy
Copy link

RiverKy commented Jul 11, 2020

themes/material/layout/_partial/structured-data.ejs替换成下面的内容貌似可以解决问题(Google初步检查通过,但正式检查仍在进行)。
你看着diff改也行,也就去掉了一个逗点。

$ diff ./structured-data-org.ejs ./structured-data.ejs 
52c52
<     "description": "<% if(page.description) { %><%= page.description %><% } else if(page.excerpt){ %><%= strip_html(page.excerpt).replace(/^s*/, '').replace(/s*$/, '') %><% } else if (config.description){ %><%= config.description %><% } %>",
---
>     "description": "<% if(page.description) { %><%= page.description %><% } else if(page.excerpt){ %><%= strip_html(page.excerpt).replace(/^s*/, '').replace(/s*$/, '') %><% } else if (config.description){ %><%= config.description %><% } %>"
<% if( (page.current === 1) && (is_home()) ) { %>
<script type="application/ld+json">
{
    "@context": "http://schema.org",
    "@type": "Website",
    "publisher": {
        "@type": "Organization",
        "name": "<%= config.title %>",
        "logo": "<%= theme.head.high_res_favicon %>"
    },
    "url": "<%- config.url %>",
    "image": {
        "@type": "ImageObject",
        "url": "<%= theme.head.apple_touch_icon %>"
    },
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "<%= config.url %>"
    },
    "description": "<%= config.description %>"
}
</script>
<% } %>

<% if( (is_post()) ) { %>
<script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "BlogPosting",
    "mainEntityOfPage": "<%- config.url + url_for(path) %>",
    "headline": "<%- page.title %>",
    "datePublished": "<%= page.date %>",
    "dateModified": "<%= page.updated %>",
    "author": {
        "@type": "Person",
        "name": "<%= config.author %>",
        "image": {
            "@type": "ImageObject",
            "url": "<%= theme.img.avatar %>"
        },
        "description": "<%- theme.uiux.slogan %>"
    },
    "publisher": {
        "@type": "Organization",
        "name": "<%= config.title %>",
        "logo": {
            "@type":"ImageObject",
            "url": "<%= theme.head.high_res_favicon %>"
        }
    },
    "keywords": "<% if(page.tags && page.tags.each) { page.tags.each(function(tag) { %><%- ',' + tag.name %><% })} %><%= theme.head.keywords %>",
    "description": "<% if(page.description) { %><%= page.description %><% } else if(page.excerpt){ %><%= strip_html(page.excerpt).replace(/^s*/, '').replace(/s*$/, '') %><% } else if (config.description){ %><%= config.description %><% } %>"
}
</script>
<% } %>

@AkinoKaede
Copy link

#732 我之前提交了pr 但作者不见了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants