首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >向WordPress静态页面添加作者和更新的架构标记

向WordPress静态页面添加作者和更新的架构标记
EN

WordPress Development用户
提问于 2017-12-23 17:05:20
回答 1查看 1.4K关注 0票数 1

Google工具在结构化数据部分向我展示了一些错误。

错误说,它找不到作者和更新的信息,在我的网站上的一些网址。

这些URL大多是静态页面,比如推荐信、联系人等等。在这些页面上有一个作者的名字或日期是没有意义的。我们的主题是基于下划线起始主题。

如果您想看到它,请看我们/template-parts/content-page.php文件中的标记是怎样的:

代码语言:javascript
运行
复制
    <?php
    /**
    * Template part for displaying page content in page.php
    *
    * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
    *
    * @package design
    */

    ?>

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <header class="entry-header">
    <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>

    </header><!-- .entry-header -->
    <?php           if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    }
    ?>
    <div class="entry-content">
    <?php
        the_content();

        wp_link_pages( array(
            'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'design' ),
            'after'  => '</div>',
        ) );
    ?>
    </div><!-- .entry-content -->

    <?php if ( get_edit_post_link() ) : ?>
    <footer class="entry-footer">
        <?php
            edit_post_link(
                sprintf(
                    wp_kses(
                        /* translators: %s: Name of current post. Only visible to screen readers */
                        __( 'Edit <span class="screen-reader-text">%s</span>', 'design' ),
                        array(
                            'span' => array(
                                'class' => array(),
                            ),
                        )
                    ),
                    get_the_title()
                ),
                '<span class="edit-link">',
                '</span>'
            );
        ?>
    </footer><!-- .entry-footer -->
    <?php endif; ?>
    </article><!-- #post-<?php the_ID(); ?> -->

任何关于如何修复结构化数据中缺少的作者和更新错误的提示,而不实际将这些错误显示到静态WordPress页面中。

谢谢

EN

回答 1

WordPress Development用户

发布于 2018-08-07 22:01:24

最佳实践将是构建您的架构,以便作者是您的组织。在架构下,itemprop=“作者”既可以是个人,也可以是组织。

如果你有另一个内容像博客文章,它应该有一个作者列出。指定一个作者可以提高你的pagerank。

作者信息可以通过使用微数据格式的模板或者使用像模式这样的插件作为单独的JSON条目放置到HTML中。JSON-LD是谷歌的首选。

票数 -1
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/289355

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档