All things Shopify and commerce
How can I dynamically display the block name as the block type for each social link in this section, instead of using icons or the standard social type?
Add 'Social Name' in 'name' instead of 'social_type'
- Helpful? Like and Accept solution! Or Support me: Buy Me Coffee ❤️
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Yes, I can do that, but I want to show the related social name for that instance in the block
This is what I intend to achieve: using the social name in the block to avoid having the same label for all the social links.
In the block section, I am getting the social_type in the Social Name field, but I’m unsure how to dynamically populate the name block with this social_type value.
Any help would be appreciated!
tks!
To dynamically display the block name as the block type for each social link, rather than using icons or standard social types (like Facebook, Twitter, etc.), follow these steps:
Each social link should be stored as a block or object, typically with attributes like name (the custom label for the social link) and type (the standard social media type, like 'Facebook' or 'Twitter').
Instead of displaying the icon or the default social type, use the block’s name attribute to replace the type. In code, you can dynamically inject the block name into the HTML or template.
If you're handling social links with JavaScript, here’s an example of how you might swap the social type for the block name:
In this example, the name (e.g., "My Business Page") replaces the icon or social media type in the rendered section.
If you're using a templating engine (like Handlebars, Django templates, or others), replace the block where you usually show the icon with the dynamic block name.
Here, {{name}} dynamically displays the block name for each social link.
Since you're not using icons, ensure that your custom block names are styled appropriately. Use CSS to make the names visually appealing in your section.
Ensure the section still looks good across different devices and screen sizes. Since you're displaying text instead of icons, adjust font sizes or layout as needed.
By accessing the block name and dynamically replacing the default social type or icon, you can create a personalized section for social links. This method allows you to display custom names or labels for each link, giving you more flexibility in how you present social connections.
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024