shopify商店使用分区和块来自定义模板样式介绍

2024-01-01 14:01:26
By 孟婆持刀砍月老

分区和块

模板使用分区来创建所需的布局。大多数分区由组成,块用于提供特定功能,例如标头、文本、单张图片、拼贴图片或链接。在模板中使用分区和块可为排列商店内容提供更大的灵活性,使您无需编辑代码即可控制在线商店的外观。

您可以向每个分区添加多种特定的块。您的模板决定哪些分区和块可用。有关哪些选项可供您使用的详细信息,请参阅您的模板文档。

某些分区对可添加的块数量或特定类型的块的数量有限制。例如,带文本图片分区只能显示模板设计器为模板指定的块。在 Shopify 的免费模板 Dawn 中,您只能添加以下块中的一个块:

  • 标题

  • 段落

  • 按钮

您可以通过编辑分区的设置来进一步自定义分区,包括添加图片和选择对齐方式、大小、背景色以及客户访问您在线商店时首先加载的内容。

如果您添加到商店布局的分区不包含您所需的设置或选项,您可以编辑模板代码或联系模板的开发人员寻求支持。

使用分区和块来自定义模板样式

打开编辑器时,系统会默认加载您商店的主页。您可以使用下拉菜单选择其他模板,或使用模板下拉菜单中的搜索栏来搜索特定页面类型。选中某个模板会将其加载到模板编辑器中,并且您所做的更改会随着您的操作在编辑器中显示预览。

Shopify商户官网原文详情:

Sections and blocks

Themes use sections to create your ideal layout. Most sections are made up of blocks that serve a specific function, such as headers, text, single images, a collage of images, or links. Using sections and blocks in your templates provides more flexibility in how you arrange your store's content, enabling you to control the look and feel of your online store without the need to edit code.

Each section has a specific variety of blocks that you can add to it. Which sections and blocks are available depends on your theme. For more information about what options are available to you, refer to your theme documentation.

Some sections have limits on the number of blocks that you can add, or limits on the number of blocks of a certain type. For example, the Image with text section can only display the blocks specified by the theme designer for your theme. In Dawn, the free Shopify theme, you can add only one of each of the following blocks:

  • a heading

  • a paragraph

  • a button

You can further customize the section by editing its Settings to include an image and choose the alignment, size, background color, and what loads first when customers visit your online store.

If the sections that you add to your store layout don't include the settings or options that you need, then you can edit your theme code or contact your theme's developer for support.

Customize your theme templates with sections and blocks

When you open the theme editor, your store's home page loads by default. You can use the dropdown menu to select a different template, or use the search bar in the template dropdown to search for a specific page type. Selecting a template loads it into the theme editor, and any changes you make are previewed in the editor as you make them.

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



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


常见问答(FQAS)


shopify是什么?

Shopify是一个全站式电子商务平台,可以帮助用户轻松地创建和运营在线商店。商店使用者可以使用它来设计商店外观、添加产品、处理订单和支付等等。

分区和块是什么?

分区和块是Shopify提供的两种方法来自定义模板文件的外观。分区可以将模板划分为不同的区域,比如页眉、主内容区域和页脚等。块可以将重复元素抽取出来,比如产品列表或Banner,然后在不同页面中重用。

如何使用分区和块自定义模板样式?

主要步骤是使用liquid标签在模板文件中定义好各个分区,然后使用include标签将块包含进来。比如可以定义一个{header}分区包含页眉内容,在{main}分区内使用include标签包含产品列表块。通过调整这些元素的布局顺序和样式属性即可实现不同的页面排版。

优势在哪里?

使用分区和块可以有效地提高模板开发效率。通过重用块元素,避免重复编写同样的代码。同时页面结构定义在分区中独立出来,更容易管理和维护。这样既能实现快速开发,也更利于后期迭代和优化店面页面。