How do I perform a HTML include in Shopify pages?

Highlighted
Tourist
7 0 1

Sorry to post another thread about this but I cannot find an answer to my problem. Perhaps it is explained better here.

 

Is anyone aware of any way to perform a 'HTML include' inside of the content of a Shopify page, i.e. a blog  post?

 

With my previous web site I used to use PHP includes and the process was simple to insert sections of HTML within HTML, from external files, for those pieces of content which are repeated across multiple pages of a web site which you would be able to update by editing only one file.

 

Let's say you wanted to include a DIV at the bottom of a blog post which includes the author's details. You would want to use a HTML include so that if those details changed in the future you could update one file and it would update across all pages.

 

I cannot find a way to do the same thing in Shopify. I've tried various Javascript methods and it isn't playing ball.

 

I know you can include Liquid snippets from within the theme files but I don't think this will work for me since I want to include the HTML in the middle of an article's content and not simply at the bottom of a page where it probably would work.

 

Is this possible?

0 Likes
Highlighted

Hello p3can,
Yes you can add html content by using blog-template.liquid file.

If you want to add html content at middle you can add it in edit blog code section.

Like this:

<span>test content</span>

Want to modify or incorporate custom changes on store, Hire us.
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Free Review and advice for sale on store Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | SEO & Digital Marketing | Site Speed Optimization | Performance Site Audit
0 Likes
Highlighted
Tourist
7 0 1

Thanks for the reply. As I understand it, that does not help me to insert HTML in the middle of a blog post. The template file will make reference to the 'article-content'. Adding code to the template file is only going to allow me to add content above or below the article content and not in the middle of it.

 

Is that correct, and if so do you know how I can include HTML in the middle of a blog post from an external file?

0 Likes
Highlighted

You can also add html at the middle of content.

Write your content inside <> this section.

Want to modify or incorporate custom changes on store, Hire us.
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Free Review and advice for sale on store Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | SEO & Digital Marketing | Site Speed Optimization | Performance Site Audit
0 Likes
Tourist
7 0 1

Thanks for the reply.

 

I'm not sure we're fully understanding one another here. I'm aware that I can insert custom HTML in the middle of a blog post using the rich text editor and using the <> function, which shows the code. I know all that.

 

What I'm trying to do is the insert HTML from another file - an external file - in the middle of a blog post. i.e. like a server-side include. 

 

Do you know this might be done?

0 Likes
Highlighted

You can't insert html from another file, you can use html tags only inside that editor.

Want to modify or incorporate custom changes on store, Hire us.
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Free Review and advice for sale on store Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | SEO & Digital Marketing | Site Speed Optimization | Performance Site Audit
0 Likes
Highlighted
Tourist
7 0 1

I was hoping someone would come at me with a workaround for this. I know there are Javascript workarounds but I cannot get any of them to work. I stumbled upon a Shopify app which took care of this problem where it allowed you to create content in the dashboard and include it anywhere on the web site by simply inserting a tag in your content like these:

 

[customhtml1]
[customhtml2]

So I know it can be done, I just don't expect to have to pay $9.99 per month for it.

 

I can't be the only person with this problem. Having the same features throughout a site's content is commonplace. To update that content you should not have to go and edit 100's of pages individually, you should edit one file and bam! job done.

1 Like