Jekyll-redirect-from questions

Hallo,

I want to migrate a blog from s9y, which is a php based blog, to jekyll

I used beautiful-jekyll to host an jekyll instance on github: aisbergde.github.io

I also found jekyll-redirect-from which should crete redirections, and it is in the list of plugins supported by github pages

I have read sometimes that github ignores the gemfile and nothing needs to be included, so I did not change it and it is still (whatever this means)

source "https://rubygems.org"

gemspec

I added one entry to the _config.xml

plugins:
  - jekyll-paginate
  - jekyll-sitemap
  - jekyll-redirect-from

and I added something into the yaml front matter of one post file, like

---
title: Warum ich seit 2017 den AnalyticsCreator verwende
subtitle: Und warum mich Wherscape nicht ĂĽberzeugt hat
tags: [analyticscreator, dwh-automatisierung, etl, elt, dwh, wherescape, data-lineage, slow-changing-dimension, scd, ssas-tabular, ssas]
redirect_from:
  -/test/001.html
---

but nothing happens:

  • no test folder is created in the repository (or will this be a virtual folder?)
  • no redirection happens when I call:

aisbergde.github.io/test/001.html

What’s my mistake?

if I get it work, my finally goal would be to emulate a php call:

aisbergde.github.io/index.php?/archives/1-Warum-ich-seit-2017-den-AnalyticsCreator-verwende.html

will this work at all?
Maybe I can’t use the redirect method at all?

redirect_from:
-/index.php?/archives/1-Warum-ich-seit-2017-den-AnalyticsCreator-verwende.html
-/test/001.html

Hey @aisbergde - welcome to the community.

Couple of thoughts:

If you’re going to be using Github Pages as your host, I’d highly recommend using the github-pages gem as Github Pages only allows a select few plugins. Docs here, but the short story is your Gemfile would be as follows:

source "https://rubygems.org"
gem "github-pages", group: :jekyll_plugins

Then, to use the jekyll-redirect-from plugin (which Github Pages allows), you’d add the following to your config.yml:

plugins:
  - jekyll-redirect-from

As for redirecting, I think you’ll be able to redirect from index.php but not index.php? using the jekyll-redirect-from plugin. So, I don’t think that plugin will solve your problem.

If nobody else chimes in with Jekyll-based solutions for redirects, I might recommend exploring solutions outside Jekyll e.g. Netlify redirects and Cloudflare Page Rules.

Good luck!

thanks for your answer. I am a little bit confused regarding the gemfile and github: in some documentations I can read that gemfiles is ignored by github and the config.yml should be used. Or did I misunderstand this?

and regarding redirect the issue could be that I need index.php? and I can’t even create a permalink using this syntax.

Gemfiles are indeed ignored by Github Pages.

Adding a Gemfile with the github-pages gem ensures your local development environment matches exactly what Github Pages uses to deploy your site. It ensures you’re using the latest version of Jekyll that Github Pages supports and reduces the number of available Jekyll plugins to just those allowed by Github Pages among other things.

You still have to explicitly declare any plugins your project requires. Declaring the plugins via _config.yml is just one of three ways to go about declaring them. The other two are described in the docs here.

Re: index.php?, yes, it’s the question mark ? that’s causing the issue. Permalinks, redirects, and any other Jekyll-based solutions that I can think of won’t work.

1 Like