Giter Club home page Giter Club logo

Comments (4)

Shen-LiPing avatar Shen-LiPing commented on June 2, 2024

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

from hexo-theme-material.

RiverKy avatar RiverKy commented on June 2, 2024

相同的错误:
image

@glennwu97 文件没问题啊🤣
image

from hexo-theme-material.

RiverKy avatar RiverKy commented on June 2, 2024

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>
<% } %>

from hexo-theme-material.

AkinoKaede avatar AkinoKaede commented on June 2, 2024

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

from hexo-theme-material.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.