shopify - 如何noindex分页页面
问题描述
如何在 Shopify 中为类别的分页页面添加 noindex 标签?我找到了声称可以做到这一点的应用程序,但我相信它应该可以在没有应用程序的情况下完成。
谢谢
解决方案
您需要知道要定位哪个模板,通常在 Shopify 中有分页的模板是:收藏、博客、搜索。
所以你应该能够在theme.liquid
:
{% if template.name == "collection" or
template.name == "blog"
%}
<meta name="robots" content="noindex, nofollow" />
{% endif %}
此 ^ 非常通用,因此如果您想更具体,可以检查页面对象(收藏、产品、页面、博客、文章等)handle
:
{% if collection.handle == "example" or
page.handle == "example" or
blog.handle == "example"
%}
<meta name="robots" content="noindex, nofollow" />
{% endif %}
推荐阅读
- time - 如何在 ESP32 和 Arduino IDE 上设置 epoch 以在没有外部 RTC 和 Wifi 的情况下更新时间?
- c# - 如何按月和 id 查询 SQL 以获取 SUM
- c# - 从字典中选择字典?
- visual-studio - 高级安装程序 - 如何添加自定义启动条件以在安装时检查是否安装了特定软件
- css-frameworks - 菜单项不显示在大屏幕上 (pure.css)
- powershell - Powershell - .csv 拆分字符串
- javascript - 将 Angular 从 8 更新到 9 后延迟加载的模块警告
- javascript - 这是在 preact/react 中为桌面和移动设备实现单独网站的最佳方式
- delphi - 一个卷如何存在于多个物理磁盘上?
- import - 在 Modelica 模型中声明包和导入包有什么区别?