javascript - 实现付费墙 : to avoid cloaking issues with paywall notice, 我应该在 HTML 中还是在 JSON-LD 中指定它?

标签 javascript html schema.org json-ld google-search-platform

问题
Google 的文档中似乎没有识别出“付费墙通知”。我试图让它对所有人可见,但从页面主题和内容中排除,而不会导致隐藏问题。 我可以在 DOM 中执行此操作(例如使用 role 属性),还是需要在 JSON-LD 标记中执行此操作?
背景
我正在使用客户端 JS 实现网站付费墙,并结合了开放图形标记和 CSS 选择器。
该实现基于 Google 在 https://developers.google.com/search/docs/advanced/structured-data/paywalled-content 上的编程建议。
这个网站上有 3 种类型的内容,在这个实现中,所有 3 种内容都由服务器为每个访问者呈现,而不管付费墙状态如何:

  • 免费内容,人人可见;
  • 付费墙通知,不是页面内容/主题的一部分,仅在未登录时可见;和
  • 付费内容,仅对登录用户和搜索爬虫可见。

  • 类型 2 是造成问题的原因,谷歌没有记录这一点。
    HTML
    <html>
      <head>
      </head>
      <body>
        <div id="div-1" class="non-paywall">
          All visitors can see this sentence, whether or not subscribed.
        </div>
        <div id="div-2" class="paywall-notice" role="dialog">
          <!-- This element is the issue in question -->
          If you are setting this notice, you are logged out our not subscribed. You cannot see the main content of this page. Please subscribe!
        </div>
        <div id="div-3" class="paywall">
          This section is paid content. 
          If you can see it, you are a logged in subscriber or a verified crawler (e.g. googlebot or bingbot).
        </div>
    </body>
    </html>
    
    JSON-LD
    {
        "@context": "https://schema.org",
        "@type": "WebPage",
        "@id": "https:\/\/foo\/page\/#webpage",
        "mainEntityOfPage": {
            "@type": "Article",
            "mainEntityOfPage": "https:\/\/bar\/article"
        },
        "isAccessibleForFree": "False",
        "hasPart": [
            {
                "@type": "WebPageElement",
                "isAccessibleForFree": "True",
                "cssSelector": ".non-paywall"
            },
            {
                "@type": "WebPageElement",
                "isAccessibleForFree": "True",
                "cssSelector": ".paywall-notice"
            },
            {
                "@type": "WebPageElement",
                "isAccessibleForFree": "False",
                "cssSelector": ".paywall"
            }
        ]
    }
    
    如果付费墙通知 (#2) 被视为与 #1 相同,则爬虫似乎有可能认为它们是页面内容的一部分并包含在与搜索意图的相关性评估中。
    我找不到任何官方承认 #2 的存在或如何处理它的指导,同时尊重付费墙标记的目标并避免隐藏问题。
    Handling isAccessibleForFree for client side paywalls 有多种方法,以及 https://webmasters.stackexchange.com/questions/117936/isaccessibleforfree-and-paywalled-content-delivered-to-googlebots 上的相关问题,这些都没有解决我上面的原始问题。
    最理想的情况是,我想按照 Google 想要的方式来实现它……只要我知道那是什么!
    更多背景
    为了能够向 googlebot 提供付费内容,服务器向所有访问者呈现相同的 HTML。
    页面加载后,一些 JS 会检查访问者是否是 googlebot,如果是:
  • 删除 .paywall-notice元素/s
  • 显示.paywall元素/s

  • 也可能有定期或交互驱动的检查来删除 .paywall非 googlebot 访问者的元素/s,但如果标记正确显示 googlebot 这些元素/s 是付费墙,则不应影响此问题。

    最佳答案

    您是否可以检测到爬虫服务器端而不渲染 paywall-notice元素吗?此标记的重点是,您不会向 Googlebot 显示与普通匿名访问者不同的内容。我想只要把文章的“付费”内容包裹在paywall类,您不必担心因伪装而受到惩罚。
    在 wsj.com 上,我们有一个服务器端付费墙,所以当 Googlebot 访问该网站时,我们甚至不会像您在 paywall-notice 中提供的那样呈现任何营销优惠。元素。我们只是渲染全文并将付费内容包装在 paywall类(class)。因此,如果可能,请向 Googlebot 发送不带付费专区通知元素的页面。
    顺便说一句,nyt.com 有一个前端付费专区,他们在标记营销优惠方面没有做任何特别的事情。他们只是将付费内容标记为与您的示例相同。只要确保删除 paywall-notice来自 hasPart数组,因为它绝对不应该在那里。

    关于javascript - 实现付费墙 : to avoid cloaking issues with paywall notice, 我应该在 HTML 中还是在 JSON-LD 中指定它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69191746/

    相关文章:

    javascript - 如何在 Django 应用程序中加载更多内容?

    javascript - 使用 Node JS 发送电子邮件

    html - Schema.org 网页 - isPartOf?

    seo - 我应该使用 schema.org 作为意见箱和问答网站吗?

    javascript - 当类成员仍然存在于页面状态时如何编写

    javascript - 无法访问关闭的 jQuery 对象的方法

    javascript - 查找所有未使用的 javascript 文件

    c# - asp.net 中的动态 Javascript

    jquery - 视频.JS : How do I add my own custom play and pause button in the middle of the video-container?

    seo - 如何为 Schema.org 中的文章设置面包屑?