Home
Wiki
Home
Wiki
  1. 2. Components
  • Back to home
  • 1. Themes
  • Vs Code
    • Getting Started
  • Kitchenware
    • Layout
      • New Layout
      • Legacy Layout
    • Components
      • Announcement
      • Banner Carousel
      • Banner With Products Carousel
      • Blog Category List
      • Blog List
      • Brand List
      • Brands Carousel
      • Breadcrumb
      • Call To Action
      • Cart
      • Categories List
      • Change Password
      • Checkout
      • Cookie Manager
      • Filter list
      • Footer
      • Forgot Password
      • Form
      • Hero Carousel
      • Icon Block
      • Invitation
      • Last Visited Products
      • Layout
      • Login
      • Map
      • Nav Bar
      • Offer
      • Product Attachments
      • Product Attributes
      • Product Documentation
      • Product Expected
      • Product Modal
      • Products Block
      • Products Carousel
      • Product Single
      • Profile
      • Quote
      • Register
      • Related Products
      • Search
      • Stores
      • Subscribe Newsletter
      • Text with Image
      • Top Bar
      • Video
    • Reusables
      • Getting Started
    • Assets
      • Getting Started
    • SDK
      • Products
        • _findProductsByCategory
        • _findProductsByIds
        • _findProductsByTitle
        • _findProductsByFilter
        • _findProductsByCriteria
        • _findProductsAndCalculate
        • _findProductsThenCalculate
        • _getProductAttributeSet
        • _setLastVisited
      • Categories
        • _findCategoryTreeById
        • _findCategoriesByIds
        • _findCategoryByAlias
        • _findCategoryTreeByAlias
        • _getCategoryContent
      • Collections
        • _getCollectionContent
        • _findCollectionsByIds
        • _findCollectionsByIdsThenCalculate
      • Brands
        • _getBrandContent
        • _findBrandsByIds
      • Cart
        • _addToCartMulti
        • _addToCart
        • _setCart
        • _clearCart
        • _setCartListener
        • _removeFromCart
        • _calculateCart
      • Checkout
        • _startCheckout
        • _updateCheckout
        • _completeCheckout
      • Shopping Lists
        • _getShoppingLists
        • _updateShoppingList
        • _createShoppingList
        • _deleteShoppingList
        • _getShoppingListByAlias
      • Navigation
        • _getFooterMenu
        • _getHeaderMenu
      • Users
        • _getUserById
      • Utils
        • _calculateCurrency
        • _getCurrencySymbol
        • _getCulture
        • _subscribeToNewsletter
        • _findUnitsByIds
  • Noir
    • 0. Introduction
    • 1. Structure
      • Overview
      • LayoutA.liquid
      • ComponentsList.liquid
      • Metas.liquid
      • CssVariables.liquid
      • Json.liquid
      • GoogleTagManager.liquid
      • StagingButton.liquid
    • 2. Components
      • Overview
      • Announcement
      • BannerCarousel
      • BlogCategoryList
      • BlogList
      • BrandList
      • Breadcrumb
      • Cart
      • CategoriesList
      • ChangePassword
      • Checkout
      • CookieManager
      • FilterList
      • Footer
      • ForgotPassword
      • Form
      • IconBlock
      • Invitation
      • LastVisitedProducts
      • Login
      • Map
      • NavBar
      • ProductAttachments
      • ProductAttributes
      • ProductComparison
      • ProductDocumentation
      • ProductMixList
      • ProductsBlock
      • ProductsCarousel
      • ProductSingle
      • Profile
      • Register
      • RelatedProducts
      • SingleBlog
      • Stores
      • TextWithImage
      • ThankYouPage
      • TopBar
      • Wishlist
    • 3. Reusables
      • Overview
      • Addresses
      • BillingRetail
      • AddressForm
      • AnnouncementModal
      • BackToTop
      • Company
      • General
      • Login
      • LoginModal
      • Orders
      • Payment
      • ProductAttachments
      • ProductAttributes
      • ProductComparisonButton
      • ProductComparisonFloatingButton
      • ProductGridItem
      • ProductListItem
      • ShoppingListsButton
      • ProductModal
      • ProfileInfo
      • PromptModal
      • Register
      • Shipping
      • ShoppingLists
      • ShoppingListsNavbar
      • Toast
      • Users
      • VariantContent
      • WishlistButton
      • Services
    • 4. Assets
      • Fonts
      • Images
      • Templates
      • Javascript
        • Overview
        • theme.js
      • Css / Scss
        • Overview
        • ThemeClasses
    • 5. SDK
      • Overview
      • LiquidGlobals
      • ServicesSDK
  1. 2. Components

SingleBlog

Purpose#

The SingleBlog component renders a single blog post page.
It:
renders the post category link (when present)
renders title, hero image, published date and estimated reading time
renders post tags and the rich HTML content
renders sticky share buttons (Facebook + LinkedIn) that share the current page URL

Inputs (model contract)#

Model shape (storefront example)#

{
  "canSharePost": true,
  "post": {
    "id": "Post Id",
    "title": "Sample title",
    "content": "<p>Sample content</p>",
    "alias": "sample-post-alias",
    "tags": [
      "sample-tag",
      "..."
    ],
    "categoryName": "Sample text",
    "categoryAlias": "sample-category",
    "publishedAt": "2026-01-01T00:00:00.0000000",
    "mediaItem": {
      "id": "Media Item Id",
      "link": "https://example.com/media/sample.jpg",
      "mediaType": "Image"
    }
  },
  "name": "SingleBlog",
  "view": "Default",
  "section": "SectionA",
  "settings": {
    "id": "Component Id",
    "section": "SectionA",
    "type": "NoirSingleBlog",
    "name": "SingleBlog",
    "configuredInContentApi": true,
    "view": "Default",
    "displayName": "",
    "cssClass": ""
  },
  "translations": {
    "clickToLearnMoreAboutCategory": "Sample text",
    "sharePost": "Sample text",
    "hours": "Sample text",
    "...": "..."
  }
}

Required fields#

settings.id
post

Optional fields#

settings.cssClass
post.categoryName, post.categoryAlias (category link is hidden if missing)
post.title
post.mediaItem.link (hero image is hidden if missing)
post.tags[]
post.content (rendered as raw HTML)
canSharePost (present in the model; the current Liquid template does not use it)
translations.*

JavaScript#

Global object#

Components/SingleBlog/Default.js exposes a single Alpine object:
Liquid binds it via Alpine:
<section x-data="singleblogdefault">

init()#

What it does
Captures pageUrl from window.location.href (used for share links).
Tracks header height (for sticky share buttons offset).
Computes the reading time based on the post content text.
Key behaviors / edge cases
Attaches resize and scroll listeners so header height stays correct.

updateHeaderHeight()#

What it does
Reads <header> height and stores it in headerHeight.

getReadingTime()#

What it does
Reads #post-wrap.innerText, counts words, and estimates reading time.
Key behaviors / edge cases
Uses wps = 3.8 (words per second).
If the result is under 1 minute, it sets time.minutes = -2.
The template treats time.minutes <= 0 as “< 1 minute”.

Dependencies#

Alpine.js
Liquid globals:
the <header> element height (sticky offset)

Notes#

Share links are built client-side using pageUrl, so they always share the current URL.
The post HTML content is rendered as raw HTML ({{ blog.content }}), so the backend is expected to provide safe HTML.

Extras#

Template behavior (Liquid + Alpine)#

Renders a category link to /blog/posts/<categoryAlias> when category info exists.
Uses a sticky share buttons column and applies a dynamic top style from headerHeight.
Displays reading time using time.hours and time.minutes computed in JS.
Modified at 2026-04-14 13:18:56
Previous
RelatedProducts
Next
Stores
Built with