Landing Page Error

Hey,
I’ve been trying to create a first landing page via the plugin, but keep receiving this error “An error occurred: body required” although the html code is already provided. I’ve tried different codes and formatting but nonetheless the error persists. I couldn’t find any references to the error either.

Can you share the html of your test page?

Are you certain you’ve included body tags?

Ignore this question, you should not have any body tags!

1 Like

I would think so!
This is the code:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%= @page_title %> | Student Club</title>
    <link rel="stylesheet" href="<%= asset_path('styles.css') %>">
</head>
<body>
    <header>
        <h1>Welcome to the <%= @club_name %></h1>
        <nav>
            <ul>
                <li><a href="#about">About Us</a></li>
                <li><a href="#events">Events</a></li>
                <li><a href="#join">Join Us</a></li>
            </ul>
        </nav>
    </header>
    <section id="about">
        <h2>About Us</h2>
        <p>We are a vibrant community of students dedicated to fostering collaboration, creativity, and personal growth.</p>
    </section>
    <section id="events">
        <h2>Upcoming Events</h2>
        <p>Join us for our exciting events that bring students together to learn and have fun!</p>
    </section>
    <section id="join">
        <h2>Join Us</h2>
        <p>Become a member today and be part of our amazing journey!</p>
    </section>
    <footer>
        <p>&copy; <%= Time.now.year %> Student Club. All rights reserved.</p>
    </footer>
</body>
</html>

But I also tried it with the code in the example of “adding and editing landing pages” or other one-liners

Sorry for the delay, busy with a couple of paid projects.

I think I may see your problem.

And apologies if my previous question confused you.

I’ve now tried to repro your issue and see my advice was incorrect.

But I can confirm the plugin still works on latest version of Discourse.

The setting is for body only.

So only what would appear between the body tags (not including the body tags).

e.g.

<div class="page one">
    <div class="standard-height">
        <div class="block"></div>
    </div>
    <div class="standard-height">
        <div class="block"></div>
        <div class="block"></div>
        <div class="block"></div>
    </div>
    <div class="standard-height">
        <div class="block"></div>
        <div class="block"></div>
        <div class="block"></div>
    </div>
    <div class="standard-height">
        <div class="block"></div>
    </div>
    <div class="standard-height">
        <div class="block"></div>
    </div>
</div>

Apologies if my previous question was confusing.

So you may need to get rid of these if your setting includes them (and corresponding closing tags):

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><%= @page_title %> | Student Club</title>
    <link rel="stylesheet" href="<%= asset_path('styles.css') %>">
</head>
<body>

Oh ok, I have found a breaking change in core that breaks a couple of things in this plugin on Latest.

Can you please confirm which version of Discourse you are running?

in any case, one of the issues, updating page body, is fixed in this presently open PR:

this should not impact Stable, either way.

Thank you for the response!
I’ve tried to fix this with just the body code (see attachments), but for some reason still receive the error.
It seems quite odd.
I am using discourse v3.4.0beta

I’ve reinstalled the plugin, and also imported your example-landing-pages to global in case that was the issue.

OK once this PR is merged, I recommend you update to latest.

Then try again.

Thanks! Got it to work

1 Like