hydecorp / hydejack

A boutique Jekyll theme for hackers, nerds, and academics
https://hydejack.com
Other
1.41k stars 799 forks source link

jekyll-redirect-from gets stuck on "Redirecting..." page #332

Open tgaff opened 1 year ago

tgaff commented 1 year ago

I'm working on a site that uses a nested structure. Hydejack has some nice breadcrumbs at the top, however I don't have an index page corresponding to each level.

I wanted to use jekyll-redirect-from (its mentioned in one of the docs) to redirect those missing indexes to a higher level index page. However when clicking the breadcrumb link it gets stuck on the "Redirecting..." page and doesn't redirect. If I manually type in the same URL it redirects correctly.

Digging into hydejack's code and the code in the jekyll-redirect-from gem, it looks like this is part of a redirect setup in hydejack not the gem so I'm reporting here. I'm guessing this has something to do with the pushstate stuff in hydejack (that's a guess though).

Example:

pets/
  index.md
  dogs/
    dog1.md
    dog2.md
  cats/
    cat1.md

In this case I added the following to pets/index.md:

redirect_from:
  - /pets/dogs
  - /pets/cats
  - /pets/dogs/
  - /pets/cats/

In this setup if I visit pets/dogs or pets/dogs/. I'm properly redirected to pets.

However if I visit pets/dogs/dog1 and click the breadcrumb for dogs, I just see a Redirecting... page with the link. That string shows in hydejack code, not in the redirect gem code.