shopify复古模板从博客文章中删除作者的姓名步骤

2024-01-01 14:01:26
By 你瞎啊撞我心上了

从博客文章中删除作者的姓名

提示:Debut 和 Minimal 在模板设置中提供删除作者的选项。访问模板编辑器并取消选中该选项即可在“博客”和“文章”分区中显示作者。

备注:本教程的步骤将根据您使用的是分区模板还是未分区模板而有所不同。分区模板支持通过拖放来安排主页的布局,未分区模板则不支持。

如果想了解您的模板是否支持分区,请转到模板的编辑代码页面。如果 Sections 目录中有文件,您则正在使用已分区模板。未分区模板是在 2016 年 10 月之前发布的,并且 Sections 目录中没有文件。

如果您使用已分区模板,请点击 Sectioned themes(已分区模板)按钮并按照说明进行操作。如果您使用较旧的未分区模板,请点击 Non-sectioned themes(未分区模板)按钮并按照说明进行操作。

删除作者的姓名

若要删除博客作者的姓名,您需要编辑 blog.liquid 和 article-template.liquid 模板中的 Liquid。如果您使用的是 Boundless,则需要编辑 blog.liquid 和 article.liquid 模板中的 Liquid。

PC:

  1. 在 Shopify 后台中,转到在线商店 > 模板

  2. 找到要编辑的模板,然后点击操作 > 编辑代码

  1. 在 Templates 文件夹中,点击 blog.liquid

  2. 在电脑上使用 ctrl + F 或在 Mac 上使用 command + F 来找到此 Liquid 标记并将其删除:

{{ article.author }}

苹果系统:

  1. 在 Shopify 应用中,轻触商店

  2. 销售渠道部分中,轻触在线商店

  3. 轻触 Manage themes(管理模板)。

  4. 找到要编辑的模板,然后点击操作 > 编辑代码

  1. 在 Templates 文件夹中,点击 blog.liquid

  2. 在电脑上使用 ctrl + F 或在 Mac 上使用 command + F 来找到此 Liquid 标记并将其删除:

{{ article.author }}

安卓系统:

  1. 在 Shopify 应用中,轻触商店

  2. 销售渠道部分中,轻触在线商店

  3. 轻触 Manage themes(管理模板)。

  4. 找到要编辑的模板,然后点击操作 > 编辑代码

  1. 在 Templates 文件夹中,点击 blog.liquid

  2. 在电脑上使用 ctrl + F 或在 Mac 上使用 command + F 来找到此 Liquid 标记并将其删除:

{{ article.author }}

对于 Simple 和 Supply,作者和日期具有相同的 Liquid 标记。若要删除这两项内容,请在电脑上使用 ctrl + F 或在 Mac 上使用 command + F 来找到此 Liquid 标记并将其删除:

{{ 'blogs.article.author_on_date_html' | t: author: author, date: date }}

如果只想保留日期,请将上方代码替换为:

{{ date }}
  1. 点击保存

  2. 在 Sections 文件夹中,点击 article-template.liquid。对于 Boundless,请在 Templates 文件夹中点击 article.liquid

  3. 在电脑上使用 ctrl + F 或在 Mac 上使用 command + F 来找到此 Liquid 标记并将其删除:

{{ article.author }}

对于 Simple 和 Supply,文章作者和文章日期具有相同的 Liquid 标记。若要删除这两项内容,请在电脑上使用 ctrl + F 或在 Mac 上使用 command + F 来找到此 Liquid 标记并将其删除:

{{ 'blogs.article.author_on_date_html' | t: author: author, date: date }}

如果只想保留日期,请将上方代码替换为:

{{ date }}
  1. 点击保存

Shopify商户官网原文详情:

Remove the author's name from blog posts

Remove the author's name

To remove the blog author's name, you will need to edit the Liquid in your blog.liquid and your article-template.liquid templates. If you are using Boundless, you will need to edit the Liquid in your blog.liquid and article.liquid templates.

PC:

  1. From your Shopify admin, go to Online Store > Themes.

  2. Find the theme you want to edit, and then click Actions > Edit code.

  1. In the Templates folder, click blog.liquid.

  2. Use ctrl + F on a PC or command + F on a Mac to locate this Liquid tag and delete it:

    {{ article.author }}

iPhone:

  1. From the Shopify app, tap Store.

  2. In the Sales channels section, tap Online Store.

  3. Tap Manage themes.

  4. Find the theme you want to edit, and then click Actions > Edit code.

  1. In the Templates folder, click blog.liquid.

  2. Use ctrl + F on a PC or command + F on a Mac to locate this Liquid tag and delete it:

    {{ article.author }}

Android:

  1. From the Shopify app, tap Store.

  2. In the Sales channels section, tap Online Store.

  3. Tap Manage themes.

  4. Find the theme you want to edit, and then click Actions > Edit code.

  1. In the Templates folder, click blog.liquid.

  2. Use ctrl + F on a PC or command + F on a Mac to locate this Liquid tag and delete it:

    {{ article.author }}
  1. For Simple and Supply, the author and date share the same liquid tag. To remove both, use ctrl + F on a PC or command + F on a Mac to locate this Liquid tag and delete it:

    {{ 'blogs.article.author_on_date_html' | t: author: author, date: date }}

    If you want to keep only the date, then replace the code above with:

    {{ date }}
  2. Click Save.

  3. In the Sections folder, click article-template.liquid. For Boundless, in the Templates folder, click article.liquid.

  4. Use ctrl + F on a PC or command + F on a Mac to locate this Liquid tag and delete it:

    {{ article.author }}

    For Simple and Supply, the article author and article date share the same liquid tag. To remove both, use ctrl + F on a PC or command + F on a Mac to locate this Liquid tag and delete it:

    {{ 'blogs.article.author_on_date_html' | t: author: author, date: date }}

    If you want to keep only the date, then replace the code above with:

    {{ date }}
  5. Click Save.

文章内容来源:Shopify商户官方网站



(本文内容根据网络资料整理和来自用户投稿,出于传递更多信息之目的,不代表本站其观点和立场。本站不具备任何原创保护和所有权,也不对其真实性、可靠性承担任何法律责任,特此声明!)


常见问答(FQAS)


如何在Shopify复古模板中从博客文章中删除作者姓名?

您可以编辑模板文件articles.liquid,找到包含作者姓名的字段,例如{{ article.author }},并删除或注释掉该字段。例如:

删除作者姓名后,是否还可以显示文章发布时间?

是的,您可以继续显示文章发布时间。例如{{ article.published_at }}就不会被删除。

删掉作者姓名后,文章列表页是否会显示异常?

不,删除作者姓名后,文章列表页结构不会出现问题。列表会根据其他字段如标题、发布时间进行展示。但是Article详情页可能会缺少作者信息。

是否可以在Shopify后台自定义每个文章的作者显示与否?

Shopify默认没有 per-article的作者显示设置功能。您需要通过编辑模板文件来全局隐藏或显示作者名字。可以考虑使用其他字段如分类来区分需要显示和隐藏作者的文章。