将索引BLog更改为目录博客[Jekyll]

时间:2016-06-08 17:41:24

标签: ruby jekyll

如何替换索引的博客列表

示例:mysite.com/blog--- layout: default --- <div class="home"> <div class="site-header-container {% if site.cover %}has-cover{% endif %}" {% if site.cover %}style="background-image: url({{ site.cover | prepend: site.baseurl }});"{% endif %}> <div class="scrim {% if site.cover %}has-cover{% endif %}"> <header class="site-header"> <h1 class="title">{{ site.title }}</h1> {% if site.subtitle %}<p class="subtitle">{{ site.subtitle }}</p>{% endif %} </header> </div> </div> <div class="wrapper"> <ul class="post-list"> {% for post in paginator.posts %} <li> <h2> <a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a> </h2> <section class="post-excerpt" itemprop="description"> <p>{{ post.content | strip_html | truncatewords: 50 }}</p> </section> <section class="post-meta"> <div class="post-date">{{ post.date | date: "%B %-d, %Y" }}</div> <div class="post-categories"> {% if post.categories.size > 0 %}in {% for cat in post.categories %} {% if site.jekyll-archives %} <a href="{{ site.baseurl }}/category/{{ cat }}">{{ cat | capitalize }}</a>{% if forloop.last == false %}, {% endif %} {% else %} <span>{{ cat | capitalize }}</span>{% if forloop.last == false %}, {% endif %} {% endif %} {% endfor %}{% endif %} </div> </section> </li> {% if forloop.last == false %} <hr> {% endif %} {% endfor %} </ul> <nav class="pagination" role="navigation"> <p> {% if paginator.next_page %} <a class="newer-posts" href="{{ site.baseurl }}/page{{paginator.next_page}}"> <span class="fa-stack fa-lg"> <i class="fa fa-square fa-stack-2x"></i> <i class="fa fa-angle-double-left fa-stack-1x fa-inverse"></i> </span> </a> {% else %} <span class="fa-stack fa-lg"> <i class="fa fa-square fa-stack-2x"></i> <i class="fa fa-angle-double-left fa-stack-1x fa-inverse"></i> </span> {% endif %} <span class="page-number">Page {{ paginator.page }} of {{ paginator.total_pages }}</span> {% if paginator.previous_page %} {% if paginator.page == 2 %} <a class="newer-posts" href="{% if site.baseurl %}{{ site.baseurl }}{% endif %}/"> <span class="fa-stack fa-lg"> <i class="fa fa-square fa-stack-2x"></i> <i class="fa fa-angle-double-right fa-stack-1x fa-inverse"></i> </span> </a> {% else %} <a class="newer-posts" href="{{ site.baseurl }}/page{{paginator.previous_page}}"> <span class="fa-stack fa-lg"> <i class="fa fa-square fa-stack-2x"></i> <i class="fa fa-angle-double-right fa-stack-1x fa-inverse"></i> </span> </a> {% endif %} {% else %} <span class="fa-stack fa-lg"> <i class="fa fa-square fa-stack-2x"></i> <i class="fa fa-angle-double-right fa-stack-1x fa-inverse"></i> </span> {% endif %} </p> <p> <a href="{{ site.baseurl }}/posts">View All Posts by Category</a> </p> </nav> </div> </div>

我已从索引中复制并制作了myste.com/blog.html,但它不起作用

extern crate gtk

use gtk::prelude::*
use gtk::Window;
use gtk::WindowType;
// ...

static mut appWindow: Option<Window> = None;

fn main() {
    // ...
    appWindow = Some(Window::new(WindowType::Toplevel))
    // ...
}

1 个答案:

答案 0 :(得分:0)

打开您的配置文件,并将baseurl设置为/ blog

baseurl: "/blog"

并在任何地方使用prepend:site.baseurl,就像您在上面的代码中使用的那样

{{ site.baseurl }}/category/{{ cat }}