Jekyll + GitHub Pages网站中的尾部斜杠导致404 [英] Trailing slashes in Jekyll + GitHub Pages site cause 404

查看:83
本文介绍了Jekyll + GitHub Pages网站中的尾部斜杠导致404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在我的网站(由Jekyll构建并托管在GitHub页面)上解析以下所有URL:




  • 解决方案

    根据GitHub的支持,这是GitHub页面中的预期行为:


    你好迈克尔,



    谢谢请与GitHub支持人员联系,以解决有关GitHub
    页面的问题。



    当前无法更改
    的尾随斜杠行为,虽然我确实知道这种情况可能会使
    感到非常沮丧。



    我会与团队分享您的用例,以供将来$ b $考虑b改进。我无法确定是否或何时会发生更改,但您的
    反馈意见掌握在正确的地方。



    谢谢,



    Steve @slgraff GitHub支持



    I would like all of the following URLs to resolve on my website, which is built with Jekyll and hosted on GitHub Pages:

    Locally they all work correctly, but right now on the live site, the first and third option resolve, but the middle one with the trailing slash causes a 404 error.

    I am not using permalinks at the moment. When I do add permalink: /about/ to the front matter in my page, the trailing slash issue is resolved, but then about.html does a 404. I suppose that's better than the current behavior but I'd prefer if all three options worked individually or redirected to one that does.

    If it's relevant, I set a canonical reference in the <head> of my layout template like so:

    <link rel="canonical" href="{{ site.url }}{{ page.url | replace:'index.html',''}}">

    And here is my my _site's file tree:

    解决方案

    According to support at GitHub this is expected behavior in GitHub Pages:

    Hello Michael,

    Thanks for contacting GitHub Support with your questions about GitHub Pages.

    There's is currently no way to change our trailing slash behavior at this time, though I do understand that a situation like this can be quite frustrating.

    I'll share your use case with the team for consideration in future improvements. I can't say if or when a change will happen, but your feedback is in the right hands.

    Thanks,

    Steve @slgraff GitHub Support

    这篇关于Jekyll + GitHub Pages网站中的尾部斜杠导致404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆