[SOLVED] Blog Duplicating Header

Ask for help or provide support to other members.
Post Reply
OneManLaptop
Posts: 68
Joined: Tue Mar 16, 2021 3:29 pm

[SOLVED] Blog Duplicating Header

Post by OneManLaptop »

Hey, I think I've uncovered a bug in the blog plugin, at least in WCMS 3.1.4. If you go back and edit the title of a blog entry, it duplicates the <h3> tag and inserts an empty tag above the actual title. I've verified it across multiple browsers. Sorry if it's already been fixed, I'm working on an older version of WCMS for now. ;)
OneManLaptop
Posts: 68
Joined: Tue Mar 16, 2021 3:29 pm

Re: Blog Duplicating Header

Post by OneManLaptop »

Hmmm, so I've had a poke around the database file and I see it's wrapping the header in a h3 tag in the database file, which I don't think it should. It's also prone to doing it with the description, wrapping that in a p tag. No problem with the main text so it's a quirk of the title and description.
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Blog Duplicating Header

Post by wiz »

Hey OneManLaptop.

One part of this seems like an old issue. If you wrap your title around any tags, it will close the ones WonderCMS creates and use yours.

WonderCMS uses this for displaying the posts on the /blog subpage:

Code: Select all

<div class="post card">
    <h3>{$post->title}</h3>
    <div class="meta">
        <div class="row">
            <div class="col-sm-12 text-right"><small>{$date}</small></div>
        </div>
    </div>
    <p class="description">{$post->description}</p>
    <a href="{$this->Wcms->url($this->slug . '/' . $slug)}" class="text-right">&#8618; Read more</a>
</div>
In the database (in latest WCMS + simple blog plugin), it doesn't wrap the title with heading tags, it does so only if you're manually setting them.
Example of latest simpleblog.json

Code: Select all

{
    "title": "Blog",
    "posts": {
        "hello-world": {
            "title": "test",
            "description": "This blog post and the first paragraph is the short snippet.",
            "date": 1656478043,
            "body": "This is the full blog post content. Here's some more example text. Consectetur adipisicing elit. Quidem nesciunt voluptas tempore vero, porro reprehenderit cum provident eum sapiente voluptate veritatis, iure libero, fugiat iste soluta repellendus aliquid impedit alias."
        },
        "test": {
            "title": "test2",
            "description": "This blog post and the first paragraph is the short snippet.",
            "date": 1656478129,
            "body": "This is the full blog post content. Here's some more example text. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quidem nesciunt voluptas tempore vero, porro reprehenderit cum provident eum sapiente voluptate veritatis, iure libero, fugiat iste soluta repellendus aliquid impedit alias."
        }
    }
}
Not sure if this helps, but seems the first issue was already fixed (wrapping in tags saved to db).
The second issue will still persist if you manually set tags in the title, the ones that are displayed on /blog subpage will be duplicated.
OneManLaptop
Posts: 68
Joined: Tue Mar 16, 2021 3:29 pm

Re: Blog Duplicating Header

Post by OneManLaptop »

Cheers Wiz, sorry for not getting back to you quicker, work has been crazy busy this past month. I'll be sure to have a closer look at all that and see what's what. :)
User avatar
wiz
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Blog Duplicating Header

Post by wiz »

No worries at all, I've been riding the same as you :)
Hold on in there, vacations coming soon!
Post Reply