GitHub源码动态导航
我今天浏览 GitHub 时发现,各个存储库导航在 URL /#! 中没有使用 hash-bangs!或 /# 并且后退按钮仍然有效。您认为他们是如何实现这一目标的?这对 Googlebot 的搜索引擎抓取有何影响?我知道它会在 url 中查找#。
我真的很好奇,因为我知道使用 /# 是很有争议的。
这是一个示例: https://github.com/mirah/pindah
谢谢!
I was browsing thought GitHub today and noticed that the individual repository navigation doesn't use hash-bangs in the URL /#! or /# and the back button still works. How do you think they are accomplishing this? How does this affect search engine crawling from Googlebot? I know it looks for # in the url.
I'm really quite curious as I know using /# is quite debatable.
Here's an example: https://github.com/mirah/pindah
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
他们不久前在博客上谈到了这一点:
https://github.com/blog/760-the -树滑块
They blogged about it a while back:
https://github.com/blog/760-the-tree-slider
该效果是通过
history.pushState()
函数和处理程序实现的popstate
事件 — 都是某些浏览器中 HTML5 DOM 界面的一部分。单击链接使用
pushState()
更新位置并将新数据加载到页面中,而无需重新加载整个页面。处理popstate
使后退按钮正常工作。GutHub 博客将其特殊用法称为“Tree Slider”(它加载树成员的内容并以可视方式将其滑动到位)。 GitHub 博客 描述了该效果及其实现。
The effect is implemented
history.pushState()
function and handlers on thepopstate
event — both a part of the HTML5 DOM interface in some browsers.Clicking the link uses
pushState()
to update the location and load new data into the page without reloading the whole page. Handlingpopstate
makes the back button work correctly.The GutHub blog calls their particular usage the “Tree Slider” (it loads the content for tree members and visually slides it into place). The effect and its implementation was described on the GitHub blog.