Blog Pages link not working

I have followed the Connect CMS video and have created Blog page that shows the blogs from collections and Blog Single page that shows the post. However, when I am connecting the Link Button from Blog page to Blog Single page using the “:slug”, I see that all my links are always opening the same first blog page.

Have tried multiple times with connecting slug but still failing and always opens first blog post. In fact all my Menu items are now pointing to the “domain.com/blog#id” which results in all broken links.

How can this be resolved?

When you link a single page, have you connected a slug in Advanced tab, under the route variables?

Yes I have done that. But when I preview and reload - it seems to not save and goes back to showing just slug entry instead of the 2nd one where $value->get(“slug”) is called.


Screenshot 2024-09-05 at 9.11.26 AM

Hello Pakic. I changed the new Route Variable adding a key slug and then connected the variable Slug from Data. Now it shows this and the links work.

But all my navbar links are not fixed yet - they still seem to append the entire Blog-single URL and then have the section ID appended at the end. How can I ensure the navbar links don’t change and retains the section IDs which navigates to proper home sections?

Screenshot 2024-09-05 at 9.17.23 AM

have you set your navbar as a component ? So you have a single navbar on all sites ?

Yes I have.

Original link: <domain.com>/#about-us
When navigated to page holding all Blogs or to single Blog
Changed link: <domain.com>/blog#about-us

I want it to retain the original link itself. Attaching the navbar setting as well

Navbar Component

Navbar Setting

Any more suggestions to try out on this issue? @Pakic @WojciechK

this needs to be one “route variable”.

In your screenshot you create $value_get(‘slug’) as a seperate variable, instead of setting that as value of variable ‘slug’

This is what I have currently. What should it change to?

And will this solve this problem?

Original link: <domain.com>/#about-us

When navigated to page holding all Blogs or to single Blog, the link changes to:
Changed link: <domain.com>/blog#about-us

I want it to retain the original link itself.

@Pakic I am trying but am not a hard-code developer. So am struggling with this. Any help is appreciated.

@talktoari :
You are struggling with “Anchorlinks” and how to achieve anchorlinks from a secondary page back to the first page. Try this solution I’ve written about earlier:

It’s a bit complex but not too complicated actually :slight_smile:

I hope this helps

Thanks @MixxMaster I guess this will help me once the routing issue above is resolved. My routing issue is basically:

Originally my navbar links are in format: <domain.com>/#about-us
When I navigate to all Blogs page or Single blog page of the collections, the nabber link changes to: domain.com**/blog**#about-us

All I’m looking for is how to ensure the nabber links don’t change to get that additional /blog in them.

After that gets sorted, I can use your solution to directly scroll to the respective page section. Thats why I was looking for DivHunt staff or @Pakic to help