question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`{{url}}` helper shows incorrect url when subdirectory equals post slug

See original GitHub issue

Issue Summary

If you create a post called /test/. And you switch to a subdirectory called /test/. Then the post should live at /test/test/, but the {{url}} helper displays /test/.

I am pretty sure it’s caused by the deduplicate sub dir helper function, see.

This bug must exist for a while (since we introduced this function).

To Reproduce

  1. Create post with slug “test” (without subdirectory)
  2. Switch to subdirectory /test/
  3. Serve your blog and see that the post url is /test/

Solution

Write a test to proof this bug. Come up with an idea how to protect against this use case.

Technical details:

  • Ghost Version: latest

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
allouiscommented, Aug 22, 2018

@kirrg001 pull #9690 looks stale - I’m gonna pick this up 🛩️

1reaction
kirrg001commented, Jun 13, 2018

@tiendq https://docs.ghost.org/docs/config#section-subpath - url configuration in your config file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Posts with same slug Redirecting to wrong post with ...
SO the issue arrise here whenever we try to access the first url it displays the template and content of 2nd url.The 2nd...
Read more >
URL of subfolder site gives error when i change permalink ...
I have installed wordpress on my site subfolder https://learnforget.com/hindi/ . URL of the subfolder site works fine when i use default url but...
Read more >
Get URL and URL Parts in JavaScript - CSS-Tricks
I want to redirect to the url(I'm trying to do it) after the equal to icon ! :-D. Please tell me the answer...
Read more >
How to get URL of current page displayed?
Some pages (e.g. my homepage) display several posts, and if I use get_permalink() on these pages, the URL of the displayed page is...
Read more >
WordPress Slugs: What They Are & How to Change Them
Usually, the culprit here is the URL slug. In this post, you'll learn what a slug in WordPress is and explore some best...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found