与Jekyll一样的Stackoverflow永久链接

时间:2013-03-30 17:23:09

标签: url stack-overflow jekyll permalinks

我真的很喜欢Stackoverflow的永久链接。我理解他们工作的方式如下:

https://stackoverflow.com/questions/uniqueid/post-title-for-seo

以下工作也完成https://stackoverflow.com/questions/15721310

https://stackoverflow.com/questions/uniqueid

有趣的是,如果您在uniqueid之后放置任何内容,您将会遇到问题

https://stackoverflow.com/questions/100001/hello-world
https://stackoverflow.com/questions/100001/hello-cruel-world
https://stackoverflow.com/questions/100001/hello-strange-world

以上所有工作,这使您可以更改问题的标题而不会丢失所有永久链接。

我正在使用jekyll,我计划在github上使用github-pages启动(不允许.htaccess)。如果可以使用没有github-pages的jekyll来完成(我确信它更容易),那么我愿意将它部署到托管的VPS。我愿意接受任何解决方案!

我还希望questions成为帖子中的特定变量,例如post.categorypost.template,例如blogportfolio

1 个答案:

答案 0 :(得分:2)

我在Jekill Docs中发现的唯一关闭是在每个帖子中定义永久链接:

---
layout: share
title: CoffeeScript Spaces and Tabs
date: 2013-09-17
categories: [coffee, eclipse, nodeclipse, enide, studio, monster]
permalink: /share/coffeescript-spaces-and-tabs
---

我在Jekyll看不到帖子ID概念的痕迹。我希望有人可以用variables或其他方式建议如何做到这一点。

相关问题