当我使用免费或付费工具(例如 Screaming Frog SEO Spider)审核网站时,我遇到以下问题:
我正在使用 Jekyll SEO 标签(版本发布 2.8.0)
如何解决这些问题?
问题描述
出现此问题的原因是,对于包含在其中一个或两者中的 Jekyll SEO 标记 URL,页面本身的 HTML 锚元素中找不到页面的
rel="next"
和 rel="prev"
属性作为超链接。分页页面应链接到常规链接,以允许用户单击并导航到系列中的下一页。它们还允许 Google 和其他搜索引擎从一个页面抓取到另一个页面,并允许 PageRank/Page Authority 在系列页面之间流动。
使用 Jekyll SEO 标签 分页 URL 不会链接到
<a>
标签内。根据 SEO 文档,这不利于它们被抓取和索引,并将 PageRank/Page Authority 传递到它们链接到的任何 URL。
解决方案
gem info jekyll
将显示类似于以下结果的输出:
*** LOCAL GEMS *** jekyll (4.x.x) Authors: Tom Preston-Werner, Parker Moore, Matt Rogers Homepage: https://jekyllrb.com License: MIT Installed at: <PATH>/ruby/3.2.0
先决条件: 在 Jekyll 文件夹中
_includes
创建 file seo-paginator.html
步骤:
从文件夹中
3.2.0
gems
文件夹jekyll-seo-tag-2.8.0
lib
template.html
文件template.html
文件{% if paginator.previous_page %} <link rel="prev" href="{{ paginator.previous_page_path | absolute_url }}"> {% endif %} {% if paginator.next_page %} <link rel="next" href="{{ paginator.next_page_path | absolute_url }}"> {% endif %}
并将它们粘贴到
seo-paginator.html
文件中。
seo-paginator.html
文件中,替换以下字符串:<link rel="prev" href="{{ paginator.previous_page_path | absolute_url }}"> <link rel="next" href="{{ paginator.next_page_path | absolute_url }}">
使用以下字符串:
<a rel="prev" href="{{ paginator.previous_page_path | absolute_url}}"></a> <a rel="next" href="{{ paginator.next_page_path | absolute_url}}"></a>
_layouts
打开 default.html
文件,然后在 body
元素中的某个位置插入以下字符串:{% include paginator.html %}
template.html
、seo-paginator.html
和default.html
文件。使用 Jekyll 重建网站,并从 Web 浏览器查看 HTML 页面的页面源。现在您会注意到存在
<a>
标签。