comprehensive-rust icon indicating copy to clipboard operation
comprehensive-rust copied to clipboard

Make `/welcome.html` redirect to `/`

Open mgeisler opened this issue 1 year ago • 4 comments

We currently have both

  • https://google.github.io/comprehensive-rust/ (there must be an index.html page here)
  • https://google.github.io/comprehensive-rust/welcome.html

online. The latter is mostly seen when you navigate forward and then back to the start page.

We should only have one page and we should make https://google.github.io/comprehensive-rust/ the canonical page.

Fixing this might involve working on mdbook to have it generate links back to the / page instead of to /index.html.

Make sure this works for the translations as well.

mgeisler avatar Jun 21 '23 08:06 mgeisler

Can I work on this issue?

AlimurtuzaCodes avatar Jun 21 '23 15:06 AlimurtuzaCodes

Can I work on this issue?

Sure, go right ahead! :smile:

mgeisler avatar Jun 21 '23 15:06 mgeisler

Could I work on this or is already taken by someone else? 😄

AlbinXXX avatar Jun 22 '23 11:06 AlbinXXX

Hey @lorinaX, you could discuss with @CYBWEBALI on how to solve this. I don't know what the plan is here, but I would be curious to hear :smile:

We also have another issue related to linking pages: https://github.com/google/mdbook-i18n-helpers/issues/35. That would also require changing mdbook or (probably easier) write a tool which can add the necessary HTML after the book has been rendered.

mgeisler avatar Jun 22 '23 12:06 mgeisler

Hi @CYBWEBALI and @lorinaX, please let me know if you have an idea for how to solve this :smile: It would be good to discuss it before either of you invest a lot of time into it.

mgeisler avatar Jun 25 '23 09:06 mgeisler

well since the other guy didn't grab this issue, I'll go ahead and work on it right now I have a few ideas on how I can do this, I will make sure to update you after I have finished a few ideas, shouldn't take me too long!

AlbinXXX avatar Jun 25 '23 13:06 AlbinXXX

Okay I'll be waiting to be updated 

Sent from Yahoo Mail on Android

On Sun, Jun 25, 2023 at 8:39 AM, Lorina @.***> wrote:

well since the other guy didn't grab this issue, I'll go ahead and work on it right now I have a few ideas on how I can do this, I will make sure to update you after I have finished a few ideas, shouldn't take me too long!

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Tnation888 avatar Jun 25 '23 13:06 Tnation888

Can you give me some exact steps for me to replicate this, I did some changes and I think it should be fine now.

AlbinXXX avatar Jun 25 '23 14:06 AlbinXXX

What do you think was the issue and what steps did you take for you to make the changes?

Sent from Yahoo Mail on Android

On Sun, Jun 25, 2023 at 9:51 AM, Lorina @.***> wrote:

Can you give me some exact steps for me to replicate this, I did some changes and I think it should be fine now.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Tnation888 avatar Jun 25 '23 14:06 Tnation888

When we go to (comprehensive-rust/index.html). This should correspond to the canonical URL https://google.github.io/comprehensive-rust/ and when we navigate through the book and we navigate back to the start page the url should be https://google.github.io/comprehensive-rust/ and not https://google.github.io/comprehensive-rust/welcome.html.

This is to my understanding and I want to make sure I don't miss any edge case or have misunderstood the problem in any way before making a PR that is why I asked for the exact steps to replicate the problem, to fix this issue was pretty simple you just need to add the following to book.toml: [output.html.redirects] "/index.html" = "/"

and to make sure we have a conical-url in the [output.excerciser] canonical-url = "http://localhost:8000" (example of my cononical-url)

(Update) unless you can run a small server I don't think there would be way to redirect this since you are hosting on github pages, my local version works with tokio and warp.

AlbinXXX avatar Jun 25 '23 15:06 AlbinXXX

So I'm in the book already idk shit what's the name of the book I'm go get me one 

Sent from Yahoo Mail on Android

On Sun, Jun 25, 2023 at 10:11 AM, Lorina @.***> wrote:

When we go to (comprehensive-rust/index.html). This should correspond to the canonical URL https://google.github.io/comprehensive-rust/ and when we navigate through the book and we navigate back to the start page the url should be https://google.github.io/comprehensive-rust/ and not https://google.github.io/comprehensive-rust/welcome.html.

This is to my understanding and I want to make sure I don't miss any edge case or have misunderstood the problem in any way before making a PR that is why I asked for the exact steps to replicate the problem, to fix this issue was pretty simple you just need to add the following to book.toml: [output.html.redirects] "/index.html" = "/"

and to make sure we have a conical-url in the [output.excerciser] canonical-url = "http://localhost:8000"

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Tnation888 avatar Jun 25 '23 17:06 Tnation888

lorinaX

I think when you set

[output.html.redirects] "/index.html" = "/"

After putting this in book.toml file image

As per docs of mdbook there is no such options, canonical-url = "http://localhost:8000"

AlimurtuzaCodes avatar Jun 26 '23 04:06 AlimurtuzaCodes

So I'm in the book already idk shit what's the name of the book I'm go get me one

Hi @Tnation888, it's great if you want to help out, but I don't understand your comment here?

mgeisler avatar Jun 26 '23 11:06 mgeisler

I think when you set

"/index.html" = "/"

It continuously re-renders the page.

Yeah, good point! Right now there are 3 valid URLs for the same page:

  • https://google.github.io/comprehensive-rust/ (preferred, works because of index.html and a GitHub default)
  • https://google.github.io/comprehensive-rust/welcome.html (named after the Markdown file)
  • https://google.github.io/comprehensive-rust/index.html (generated by mdbook, I haven't looked up how)

Perhaps we could start by renaming welcome.md to index.md? That would reduce the number of URLs by one.

mgeisler avatar Jun 26 '23 16:06 mgeisler

I think when you set

"/index.html" = "/"

It continuously re-renders the page.

Yeah, good point! Right now there are 3 valid URLs for the same page:

  • https://google.github.io/comprehensive-rust/ (preferred, works because of index.html and a GitHub default)
  • https://google.github.io/comprehensive-rust/welcome.html (named after the Markdown file)
  • https://google.github.io/comprehensive-rust/index.html (generated by mdbook, I haven't looked up how)

Perhaps we could start by renaming welcome.md to index.md? That would reduce the number of URLs by one.

I can try this.

AlimurtuzaCodes avatar Jun 26 '23 16:06 AlimurtuzaCodes

I renamed welcome.md to index.md in #1039. It would still be nice if /index.html URLs would instead become / (for all languages), but that's probably something we need to fix in upstream mdbook.

mgeisler avatar Aug 02 '23 09:08 mgeisler

This upstream issue would take care of removing the index.html parts from our URLs: https://github.com/rust-lang/mdBook/issues/1251.

mgeisler avatar Aug 02 '23 09:08 mgeisler