My client would like to add a quote to each post and have it to the side of each post.
I’ve attached the wireframe for reference.
Does anyone have any suggestions on how to accomplish this?
My client would like to add a quote to each post and have it to the side of each post.
I’ve attached the wireframe for reference.
Does anyone have any suggestions on how to accomplish this?
Interesting question! It it looks like you need formatting for this content, right? Not just a text string.
How comfortable with HTML is the client?
Two thoughts:
<b>
tags, they can probably handle it. This is by far the simplest solution.<div id="@slug"></div>
<script>
yourCustomFunction("{{content}}", "@slug")
</script>
And then yourCustomFunction (defined just once on the page, not in the foreach) extracts the first blockquote or product card or some other structure you can pull out with querySelector, grabs the contents, and inserts it into that target div.
This is significantly more complex and involves loading the full html of the post body on the index page (which has implications for page loading times of slow networks). I think you’d be better served by option #1 in this case, since the html to be inserted looks pretty simple. I’d go with option #2 if you needed something more complex, like a video added to the index page.