更改侧边栏 Octopress 整合了一些第三方服务,让它们出现在侧边栏来丰富博客,比如 Twitter, Pinboard 和 Delicious 。 在 _config.yml 文件里,你可以重新排列这些第三方服务的显示顺序。 可以为 帖子 和 页面 设置不同的侧边栏第三方服务的显示顺序。 还可以用 HTML 创建添加属于你的完全个性化的侧边栏部分。 Sidebar configuration (_config.yml) default_asides: [asides/recent_posts.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html] # blog_index_asides: # post_asides: # page_asides: 如果你想添加一个部分到您的侧边栏,在这个文件夹下面创建文件 source/_includes/custom/asides/ 由于许多人想添加一个 关于我,那么就拿这个作示范吧。 cd source/_includes/custom/asides/ 文件夹下面已经有一个 关于我 文件了 ls -l about.html 如果没有就需要创建并且编辑它。 nano about.html <section> <h1>About Me</h1> <p>A little something about me.</p> </section> 这里要注意的是, <section> 和 </section> 是包含整个部分的块, 下面加一行 <h1>About Me</h1> 是标题,About Me 请自己发挥创造力 <p>A little something about me.</p> 是内容,也可以自己更改的。 写好了保存退出。 回去编辑 _config.yml 文件 nano _config.yml default_asides: [asides/recent_posts.html, custom/asides/about.html, asides/github.html] blog_index_asides: [asides/recent_posts.html, custom/asides/about.html, asides/github.html] post_asides: [asides/recent_posts.html, custom/asides/about.html, asides/github.html] page_asides: 上面的实例里面,是添加了 博客全局,主页和博客帖子的侧边栏的 挂件项目。 有三个挂件 最近帖子,关于我和 github网站 保存退出,然后生成网站就能看到侧边栏了。 |