Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67556

Is there a way to execute script tags inside a v-html? (Nuxt blog with Ghost Headless CMS)

$
0
0

I've built a blog using Nuxt and Ghost. The problem is, Ghost sends the post as an html string, and after looking around, I learned that I should use v-html for that. It works, excepts script tags inside that html don't get executed properly, so I can't embed things like Twitter posts, GitHub gists etc. Script tags get executed for a split sec, because I can see the gist displaying for a sec if I reload the page, then it disappears again. But script tag inside the DOM still stays intact.

Here is an example from the html coming from Ghost:

<p>Now we can create our lanes in <code><strong>android/fastlane/Fastfile</strong></code></p>
<script src="https://gist.github.com/bbedward/e59644e5d840a2d104c119d2c850475a.js"></script>

p, code, and strong tags work, but script one doesn't. This is how I'm inserting the html coming from Ghost into my Nuxt page:

<div class="content">
    <div v-html="post.html"></div>
</div>

I'm wondering how am I supposed do achieve what I want, since html is coming from the Ghost server and getting rendered via Nuxt just before it's delivered to the client, there is not much I can do on it since that would slow things down I'm guessing.


Viewing all articles
Browse latest Browse all 67556

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>