Skip to content

Script tag portals body data when empty #42

Description

@theashguy

Not sure whats going on here but checkout this layout function.

pub fn layout() -> content::Html<String> {
    content::Html(html!(
        <>
            <HTML5Doctype />
            <html lang={"en"}>
                <head>
                    <title>{"Test"}</title>
                    <link href={"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"} rel={"stylesheet"}></link>
                    <script src={"/assets/main.js"}></script>
                </head>
                <body>
                    <Header />
                    <Nav title={"My title"} body={"Once you have their money, you never give it back."} />
                    <div>{"Title"}</div>
                </body>
            </html>
        </>
    ))
}

When I use the above, the entire body content gets rendered inside of the <script> tag. However if I add an empty template string inside the script tag it will work fine... like this...

<script src={"/assets/main.js"}>{""}</script>

I'm assuming that it's not closing out empty tags.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions