### Access Specific Product with Sline Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example demonstrates how to retrieve a specific product using its handle and display its title and URL. It utilizes the `get` filter with the `all_products` object. ```html {{#var product = all_products | get("earring-ab001") /}} {{#link_to product.url}} {{product.title}} {{/link_to}} ``` -------------------------------- ### Access Specific Blog with Sline Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example demonstrates how to retrieve a specific blog by its handle and display its title and URL. It utilizes the `get` filter with the `all_blogs` object. ```html {{#var blog = all_blogs | get("news") /}} {{#link_to blog.url}} {{blog.title}} {{/link_to}} ``` -------------------------------- ### Format Address Display Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example demonstrates how to format and display an address object. It utilizes a helper function `format_address` to render the address details. ```HTML {{#format_address address /}} ``` -------------------------------- ### Implement Pagination with Sline Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example demonstrates how to implement pagination for displaying products. It fetches product data with a specified page size and renders navigation links for previous and next pages. ```html {{#var paginate = all_products | get_product_pagination(5) /}} {{#for product in paginate.list}} {{#link_to product.url}} {{product.title}} {{/link_to}} {{/for}} ``` -------------------------------- ### Display Product Details with product Object Source: https://github.com/slinedev/sline-docs/blob/main/object.md The `product` object represents a single product in the store, including its title, description, price, images, and variants. This example displays the product title, description, and formatted price. ```HTML

{{product.title}}

{{product.description}}

{{product.price | money}}
``` -------------------------------- ### Access Specific Page with Sline Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example demonstrates how to retrieve a specific custom page using its handle and display its title and URL. It utilizes the `get` filter with the `all_pages` object. ```html {{#var page = all_pages | get("privacy-policy") /}} {{#link_to page.url}} {{page.title}} {{/link_to}} ``` -------------------------------- ### Display Shop Information with shop Object Source: https://github.com/slinedev/sline-docs/blob/main/object.md The `shop` object provides basic information and settings for the store, including its name, description, currency, and contact details. This example displays the shop's name and description. ```HTML

{{shop.name}}

{{shop.description}}

``` -------------------------------- ### Render Section with Settings and Blocks Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example shows how to render a section, accessing its ID and settings, and iterating through its blocks. It displays a section title and renders the content of each block based on its type. ```HTML

{{section.settings.title}}

{{#blocks}} {{#block /}} {{/blocks}}
``` -------------------------------- ### Conditional Logic for Theme Settings in HTML Source: https://github.com/slinedev/sline-docs/blob/main/object.md Demonstrates how to access and use global theme settings defined in `theme.config.json`. This example checks the `cart_add_type` setting to determine whether to open a drawer or redirect to the cart page. ```html {{#if settings.cart_add_type == "drawer"}} 打开抽屉式购物车。 {{#else}} 跳转到购物车页面。 {{/if}} ``` -------------------------------- ### Render Filter Options with Sline Source: https://github.com/slinedev/sline-docs/blob/main/object.md This code example shows how to render filter options for a given search. It iterates through the filters and then through the values of each filter, creating checkboxes for user interaction. ```html {{#for filter in search.filters}}

{{filter.label}}

{{#for value in filter.values}} {{/for}} {{/for}} ``` -------------------------------- ### Display Country and Currency Information Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example shows how to display the current country's name and its currency's ISO code using localization data. It's useful for internationalized websites. ```HTML

当前国家:{{localization.country.name}}

货币:{{localization.country.currency.iso_code}}

``` -------------------------------- ### Navigate using Shop Routes Source: https://github.com/slinedev/sline-docs/blob/main/object.md The `routes` object contains URL paths for important pages within the shop, such as the account page, cart page, and search page. This example shows how to link to the cart and account pages. ```HTML 购物车 我的账户 ``` -------------------------------- ### Access and Display Metafield Values Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example shows how to retrieve metafields for a product, specifically looking for a 'description' metafield within the 'custom' namespace. It then conditionally displays the value if it exists. ```HTML {{#var custom_field = product | get_metafields("custom") /}} {{#if custom_field.description}}

{{custom_field.description.value}}

{{/if}} ``` -------------------------------- ### Display Page Content and Metadata Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example shows how to display the title, content, and last updated timestamp of a page. It structures the content within an article tag for semantic HTML. ```HTML

{{page.title}}

{{page.content}}

最后更新:{{page.updated_at | date}}

``` -------------------------------- ### Access Specific Article with Sline Source: https://github.com/slinedev/sline-docs/blob/main/object.md This code snippet shows how to retrieve a specific blog article by its handle and display its title and URL. It uses the `get` filter with the `all_articles` object. ```html {{#var article = all_articles | get("news/blog-2") /}} {{#link_to article.url}} {{article.title}} {{/link_to}} ``` -------------------------------- ### Render Media Based on Type Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example shows how to render different media types (image or video) based on the `media.media_type` property. It uses a switch statement to conditionally display an image or embed a video. ```HTML {{#switch media.media_type}} {{#case "image" /}} {{media.alt}} {{#case "video" /}} {{#video_tag media /}} {{/switch}} ``` -------------------------------- ### Create Language Selection Dropdown Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example shows how to create a dropdown menu for selecting languages. It iterates through available languages and creates an option for each, using the language's ISO code and endonym name. ```HTML ``` -------------------------------- ### Get Product Variants Source: https://github.com/slinedev/sline-docs/blob/main/filter.md Fetches all variant objects for a specified product. It takes a product object and returns an array of its variants. ```html {{#var myVariants = product | get_variants() /}} {{#for variant in myVariants}} {{ variant.title }} {{/for}} ``` -------------------------------- ### Display Page Content with page Object Source: https://github.com/slinedev/sline-docs/blob/main/object.md The `page` object provides information about the current page, including its title, content, creation date, and URL. This example demonstrates displaying the page title, content, and last updated time. ```HTML

{{page.title}}

{{page.content}}

最后更新:{{page.updated_at | date}}

``` -------------------------------- ### Display Collection Information with collection Object Source: https://github.com/slinedev/sline-docs/blob/main/object.md The `collection` object provides information about a product category, including its title, description, and associated products. This example displays the collection title and iterates through its products. ```HTML

{{collection.title}}

{{#for product in collection.products}}
{{product.title}}
{{/for}} ``` -------------------------------- ### Check if String Starts With Prefix Source: https://github.com/slinedev/sline-docs/blob/main/filter.md Checks if a string begins with a specified prefix. It returns a boolean value and takes the prefix as a string argument. ```html {{ "Fake Two-piece Cardigan" | starts_with("Fake") }} ``` -------------------------------- ### Get Product Collections Source: https://github.com/slinedev/sline-docs/blob/main/filter.md Retrieves all collection objects associated with a given product. It takes a product object as input and returns an array of collections. ```html {{#var myCollections = product | get_collections() /}} {{#for collection in myCollections}} {{ collection.title }} {{/for}} ``` -------------------------------- ### Access Store Navigation Menus with Linklists Object Source: https://github.com/slinedev/sline-docs/blob/main/object.md The Linklists object provides access to all navigation menus in the store. You can access specific menus using their handle. This example iterates through the links of the 'main-menu' and renders them as links. ```HTML {{#for link in linklists.main-menu.links}} {{#link_to link.url}} {{link.title}} {{/link_to}} {{/for}} ``` -------------------------------- ### Get Single Product Source: https://github.com/slinedev/sline-docs/blob/main/filter.md Fetches a specific product object, typically used in conjunction with line items or gift cards. It takes an object containing product information. ```html {{#var myProduct = gift_card | get_product() /}} {{ myProduct.title }} ``` -------------------------------- ### Access Specific Collection with Sline Source: https://github.com/slinedev/sline-docs/blob/main/object.md This code snippet shows how to retrieve a specific collection by its handle and display its title and URL. It uses the `get` filter with the `all_collections` object. ```html {{#var collection = all_collections | get("bottom") /}} {{#link_to collection.url}} {{collection.title}} {{/link_to}} ``` -------------------------------- ### Get Resource by ID or Handle Source: https://github.com/slinedev/sline-docs/blob/main/filter.md Retrieves a single resource object (like products, collections, articles) using its ID or handle. It requires a collection of resources and the identifier as input. ```html {{#var myProduct = all_products | get("winter-wonderland-gift-box") /}} {{ myProduct.title }} ``` -------------------------------- ### Apply Color Styles with Color Object Source: https://github.com/slinedev/sline-docs/blob/main/object.md The Color object allows setting different color styles for various website components. It provides properties like alpha, red, green, blue, and RGB/RGBA string representations. This example shows how to apply header and border colors using the Color object. ```CSS .header { background-color: {{settings.header_color.rgb}; border-color: {{settings.accent_color.rgba}}; } ``` -------------------------------- ### Generate Country Option Tags for Shipping Source: https://github.com/slinedev/sline-docs/blob/main/object.md This example generates `