Forum
Blog App: Home page posts plus list & detail pages
I've added a couple of test blog articles to a client's site which is presently in development/preview mode on my own domain. The url links are all working well on the blog list and detail pages, as seen here:
List: https://www.berniebradleywebsites.co.uk/client_preview/adastra/blog/index.php Detail: https://www.berniebradleywebsites.co.uk/client_preview/adastra/blog/post.php?s=2014-11-13-dog-friendly-places-in-lytham-st-annes
I've also tried to pull (up to) 3 blog posts through onto the home page - the blog articles are being pulled through, but for some reason the url is incorrect and it's missing out the 'adastra' folder:
Instead of the url being: https://www.berniebradleywebsites.co.uk/client_preview/adastra/blog/post.php?s=2014-11-13-dog-friendly-places-in-lytham-st-annes
It's linking to: https://www.berniebradleywebsites.co.uk/client_preview/blog/post.php?s=2014-11-13-dog-friendly-places-in-lytham-st-annes
How do I correct the url path of the blog articles on the home page without it changing the url on the blog listing page?
My code on the home page that pulls through the posts is:
<?php perch_blog_recent_posts(10); ?>
Many thanks,
Bernie
What value have you set for it on the Settings page?
Hi Drew,
The path is set to: ../blog/post.php?s={postSlug}
Slug format: %Y-%m-%d-{postTitle}
That's a page-relative path, so it won't work from all locations. I suggest making it root-relative.
When I do that, it fixes the home page blog urls but it breaks the urls on the blog listing (index.php) page.
How do I resolve that, then the index.php home page and blog index.php page are in different directories?
By making the path root-relative.
Hi Drew,
Thanks for your reply.
I did indeed set it to that path in the Blog settings - the home page blog urls then worked but the blog listing page urls didn't. When I tweaked the path, the blog listing urls worked but then the home page blog urls didn't! Couldn't get both urls to work at the same time.
In the end, I added a root-relative path in the post.html and post_in_list.html templates /client_preview/adastra/
and set a different path in the admin blog settings ../adastra/blog/post.php?s={postSlug}
Not sure if that's the best way to resolve it but it did the trick!
Many thanks for the great (and prompt) support as always. Have a fab day.
Bernie