New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customize HTML of redirect-page #55

Closed
tommy-carlier opened this Issue Nov 17, 2014 · 19 comments

Comments

Projects
None yet
@tommy-carlier
Copy link

tommy-carlier commented Nov 17, 2014

It would be nice to be able to customize the HTML-code of the redirect-page. Because this page is visible while the browser is redirecting, it would look better if custom styling and messages could be displayed. It would also allow us to not redirect immediately, but to wait 1 or more seconds.

Suggestion: if the folder _layouts contains a file _redirect.html, use this file as the template.

@aarongustafson

This comment has been minimized.

Copy link

aarongustafson commented Dec 16, 2014

I like this idea. I’m also keen to make the HTML validate (there is no body element, etc.). I would recommend keeping the template small for performance reasons though.

@gjtorikian

This comment has been minimized.

Copy link
Member

gjtorikian commented Jan 27, 2015

@parkr Is there something we can add here to style the page? Perhaps a config key like redirect_layout that defines which layout file to use?

/cc @jordanmccullough

@parkr

This comment has been minimized.

Copy link
Member

parkr commented Jan 27, 2015

When is the page visible? For how long? On what kind of connection? I've never seen this page actually rendered before on the browsers I've tested it with, but I could be blind to something. Ideally there is no customization here.

@jordanmccullough

This comment has been minimized.

Copy link

jordanmccullough commented Jan 27, 2015

@parkr, Using Google Chrome version 40.0.2214.91 the redirect shows for 450ms.

@gjtorikian

This comment has been minimized.

Copy link
Member

gjtorikian commented Jan 27, 2015

If it helps you might want to go to a page that's not in your cache, perhaps https://help.github.com/enterprise/. The styleless message flashes rather quickly.

Even still, this plugin provides a link in the event that the browser cannot redirect a user (or they have JavaScript turned off). That's pretty great. In those cases, I can see a style override being useful, too.

@pathawks

This comment has been minimized.

Copy link
Member

pathawks commented Jan 27, 2015

I’m also keen to make the HTML validate (there is no body element, etc.).

It's valid. See the explanation on pull request #20

@parkr

This comment has been minimized.

Copy link
Member

parkr commented Jan 28, 2015

If we're going to customize, a layout is really the only customization I'm happy with. How can we integrate these pages with the server technology directly? @gjtorikian, could nginx be told if these files were written out in a certain way? Then the 301 would be given by the server directly.

@gjtorikian

This comment has been minimized.

Copy link
Member

gjtorikian commented Jan 28, 2015

Then the 301 would be given by the server directly.

Although this would be super preferable, I'm not sure it's feasible.

Nginx can certainly read the contents of a file before serving it. So perhaps we could receive a destination, read the file to see if it's a redirect, then 301 to the redirect instead. But that path sounds like there be dragons. IIRC, nginx can also incorporate rules via include, so assuming a magical world without malicious users where this plugin defines a flat list of nginx rules for the server to include, that might work too.

Of course I could just be completely wrong about all this.

If we're going to customize, a layout is really the only customization I'm happy with.

What input would you like to see a user provide to be able to get to their desired output?

@pathawks

This comment has been minimized.

Copy link
Member

pathawks commented Jan 28, 2015

Perhaps if the plugin could even generate a key–value list of redirects, then something else in the deploy chain could make use of that info to generate proper 301 redirects on the server.

@eksperimental

This comment has been minimized.

Copy link
Contributor

eksperimental commented Feb 28, 2015

@jordanmccullough i'm using the latest chrome, and I can see for a little while the message that you are being redirected to another page.

@TWiStErRob

This comment has been minimized.

Copy link

TWiStErRob commented Jun 12, 2015

@gjtorikian your uncached page showed the redirect page for almost a second and I have a strong machine.

I'm all for a server-side redirect. It would skip the flashing page even if the html file is there. Maybe you could add options to _config.yml for some commonly used server types like so:

gems:
  - jekyll-redirect-from
jekyll-redirect-from:
  outputs:
    - html # current style
    - raw # key-value pairs (maybe a separate raw-separator config)
    - nginx
    - htaccess
  redirect-layout: my-redirect

I also like the idea of custom layout, even if I can only replace the <h1> and the <a>.

@ndarville

This comment has been minimized.

Copy link
Contributor

ndarville commented Jul 27, 2015

👍

I need to change it for

  1. My HTML/JS linter, which flags the single quote in the script part
  2. Non-English visitors (there are a couple of them out there) :)
@parkr

This comment has been minimized.

Copy link
Member

parkr commented Jul 27, 2015

I'd be ok with a PR for this if anyone has the time.

@parkr

This comment has been minimized.

Copy link
Member

parkr commented Jan 10, 2016

I think allowing the user to specify a _layouts/jekyll-redirect-from.html would be ideal. I'd strongly consider a PR which allowed the author to specify a layout and use the default boring one if none is suggested.

@pathawks pathawks referenced this issue Jan 29, 2016

Closed

WIP: Allow custom layout for redirect page #94

2 of 3 tasks complete
@Freso

This comment has been minimized.

Copy link

Freso commented Feb 4, 2016

Or perhaps just use standard layout and content from Jekyll? See discussion at loot/loot.github.io#50 (diff) - I actually thought instinctively that this would be how it worked, as it seems like the most seamless integration with jekyll.

@TWiStErRob

This comment has been minimized.

Copy link

TWiStErRob commented Jul 6, 2016

This is still a valid feature as far as I know, waiting to be implemented.

@jekyllbot jekyllbot removed the stale label Jul 6, 2016

@parkr

This comment has been minimized.

Copy link
Member

parkr commented Jul 7, 2016

Fixed by #94. Working on it over there.

@seanmhanson

This comment has been minimized.

Copy link

seanmhanson commented Aug 23, 2016

It looks like #94 was closed without merging and won't be fixed or supported—but I'd like still like to either have this redirect without the "redirecting" page at all. If that's not the case, there's a pretty strong use case for allowing a user to define a template or page to use—namely that there's no excuse for 500ms of raw HTML to ever appear on a professional website at all, and solutions like .htaccess etc. are not feasible for github-pages, which remains one of the largest draws for jekyll users.

@parkr can you clarify a bit what is invalid about this feature request / what would make it valid enough to accept PRs or focus on, rather than closing out without fixing?

@benbalter

This comment has been minimized.

Copy link
Contributor

benbalter commented Aug 23, 2016

Looking at #94, I'm not sure that PR would have solved what's being discussed here. It sounds like there are two problems:

  1. The desire to have server side redirects. That's out of scope for this plugin, or at least there's been no technical way suggested to facilitate server side redirects.
  2. The desire to not have un-styled HTML flash for less than a second

On the second one, would the ability to specify a custom CSS file help? If not, I'd suggest implementing the redirect template yourself as a standard template.

The plugin is intended to help the user get from an old URL to a new URL. Looking at #94, It seems custom templates add a significant amount of complexity to an otherwise simple plugin. I can sympathize with not wanting an un-styled redirect page, but I'm not sure it's the most pressing issue to tackle, especially given the amount of complexity it would introduce.

@dcwalk dcwalk referenced this issue Nov 22, 2016

Closed

Add page for mini-conf #87

3 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment