1

このページhttp://brandonmathis.com/projects/のように、独自のインデックスを持つプロジェクトを作成するにはどうすればよいですか?

4

1 に答える 1

1

1 つのオプションを次に示します。

Octopress サイトのルートに projects というディレクトリを作成します。その中に、ファイル 'index.html' とディレクトリ _posts: を入れると、次のようになります。

_layouts/
_plugins/
_posts/
    some_post_that_is_not_a_project.md
projects/
    index.html
    _posts/
        some_project.md
        some_other_project.md
index.html
config.yml

その _posts ディレクトリ内で作成した投稿は、自動的に「プロジェクト」カテゴリに属します。これは、projects/index.html に次のようなものを配置できることを意味します。

<ul>
{% for post in site.categories.projects %}
    <li>
    <a href="/{ post.permalink }}">
        <img src="{{ post.image }} alt="{{ post.title }}></img>
        <h3>{{ post.title }}</h3>
        <p>{{ post.summary }}</p>
    </a>
    </li>
{% endfor %}
</ul>

そして、次のような投稿があります。

---
title: Fancy buttons
image: /path/to/some/image.jpg
summary: |
    I created Fancy Buttons (a Compass plugin) to make it easy to design gorgeous
    customizable CSS buttons in seconds.
|
---

Here is the longer content of this post etc etc which will
appear on the project page itself...

これは、ナビゲートと保守が容易な明確で実用的なディレクトリ構造を持っているため、これを行うのに適した方法です。

お役に立てれば。

于 2012-11-02T16:10:10.240 に答える