Forum

Thread tagged as: Question

Blog slug problems. Runway.

I have a couple issues relating to blog slugs I am looking for advice on please.

Issue 1: Blog preview

As stated in https://docs.grabaperch.com/addons/blog/runway/config/ I have added perch_blog_check_preview(); to my index, archive, authors and post pages. I have also added latest-news/[slug:s]/[preview:preview] to my URL pattern to post and archive pages.

When trying to preview a blog post, pressing View Post results in the following URL and a Not Found warning. /perch/addons/apps/perch_blog/edit/latest-news/2018-02-19-test-post-three. So this seems to be looking in the core? I presume is should not?

Issue 2: Archive posts links

Pressing Categories / News link takes me to an Archive of News page. Resulting URL: /latest-news/category/news Which is correct. However, pressing a post link which should take me to the post, results in a broken link. For example, /latest-news/category/latest-news/2018-02-19-test-post-three. This URL should be /latest-news/2018-02-19-test-post-three? So /latest-news/category/ is being generated unnecessarily?

For both issues, routing token has been defined as:

    'routing_tokens' => [
      'blogslug' => '[1-2][0-9]{3}\-[0-9]{2}\-[0-3][0-9]-[a-z0-9\-]+',
    ],
Grant Smith

Grant Smith 0 points

  • 3 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Issue 1

/perch/addons/apps/perch_blog/edit/latest-news/2018-02-19-test-post-three

Is this the link you get when clicking preview? What's your "Blog post page path" in the site's Settings?


Issue 2

It sounds like you need to edit the links in your template or the "Blog post page path" in the site's Settings. What does the link look like in your template? Like this?

<a href="<perch:blog id="postURL" />">Link</a>

Issue 1

Blog post page path is latest-news/{postSlug}. /perch/addons/apps/perch_blog/edit/latest-news/2018-02-19-test-post-three is the URL I get when clicking preview.

Issue 2

I played with this a bit. My Blog page and Archive page both use my /perch/templates/blog/post_in_list.html template. This has various ways of getting to the post, but if I just give one example.

<a class="blog_buttom" href="<perch:blog id="postURL" />" rel="bookmark">Read More</a>

I did add latest-news/ so the href was /latest-news/<perch:blog id="postURL" />. But this results in these links not working anywhere. Whereas changing to just <perch:blog id="postURL" /> means the links work on /templates/pages/blog/index.php page.

The resulting url of adding latest-news/ is /latest-news/latest-news/2018-02-19-test-post-three

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Try adding a slash at the start of the blog post page path in the Settings.

GENIOUS!

and DOH! for me