Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/r12f/hexo-tag-post-link

A hexo tag plugin for inserting post link in your posts with your own format.
https://github.com/r12f/hexo-tag-post-link

Last synced: 7 days ago
JSON representation

A hexo tag plugin for inserting post link in your posts with your own format.

Awesome Lists containing this project

README

        

# hexo-tag-post-link

[![npm version](https://badge.fury.io/js/hexo-tag-post-link.svg)](http://badge.fury.io/js/hexo-tag-post-link)

A hexo tag plugin for inserting post link in your posts with your own format.

## Installation

``` bash
$ npm install hexo-tag-post-link --save
```

## Usage

1. Create "_data" folder under "source" folder, if you don't have it.
2. Create "post_link.yml" in your "source/_data" folder
3. Add your own post link format in ymal
```
name: format
```

Example
```
header: The link to this post: <%= post_title %>
```

4. Add post link tag to wherever you like in your post
```
{% post_link %}
```
Example:
```
{% post_link header %}
```

### Adding post link to all posts
hexo-tag-post-link supports adding post link to all posts by setting the ```_config.yml``` file:
```
post_link:
insert_before_post:
insert_after_post:
```

Let's say we have template ```header``` and ```footer``` defined in our postlink.yml data file. Then we could use the following configuration to add them to all posts.
```
post_link:
insert_before_post: header
insert_after_post: footer
```

### Adding post link to posts in certain category or with certain tag
hexo-tag-post-link also supports per type configurations in ```_config.yml``` file. For example:
```
post_link:
per_type_configs:
- type: category
name: "category-name"
insert_before_post: "header-for-category"
insert_after_post: "footer-for-catefory"
- type: tag
name: "tag-name"
insert_before_post: "header-for-tag"
insert_after_post: "header-for-tag"
```

### Disable global post link for certain post
Just add ```disable_global_post_link: true``` in the front matter.
```
---
title: title
categories:
- category-name
tags:
- tag-name
disable_global_post_link: true
---
```

## Supported Variables:

* site_title
* site_subtitle
* site_description
* site_author
* site_url
* post_title
* post_slug
* post_created
* post_created_date
* post_created_time
* post_updated
* post_updated_date
* post_updated_time
* post_relative_url
* post_permalink

## License

BSD v3