This repository has been archived by the owner. It is now read-only.
Archives for acyort
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.editorconfig
.eslintignore
.eslintrc
.gitignore
.npmignore
.travis.yml
LICENSE
README.md
index.js
package-lock.json
package.json

README.md

acyort-archives

Build Status codecov

Archives for AcyOrt

Install

$ npm i acyort-archives -S

Usage

# config.yml

plugins
  - acyort-archives

archives:
  per_page: 5         # or 0
  template: archives  # custome template, default is archives
  path: archives      # custom path, default is archives
  title: archives     # custom title, default is archives
<!-- template archives example -->
<div class="archives">
  {% for post in page.posts %}

  {% if !post.id  %}
    <h3 class="year">{{ post }}</h3>
  {% else %}
    <p>
      <span>{{ _time(post.created, 'MM-DD') }}</span>
      <a href="{{ _url(post.url) }}">{{ post.title }}</a>
    </p>
  {% endif %}

  {% endfor %}
</div>

<div class="pagination">
  {% if page.prev %}
  <a rel="prev" href="{{ _url(page.prev) }}">{{ _url(page.prev) }}</a>
  {% endif %}

  <span>{{ page.current }}</span>
  /
  <span>{{ page.total }}</span>

  {% if page.next %}
  <a rel="next" href="{{ _url(page.next) }}">{{ _url(page.next) }}</a>
  {% endif %}
</div>