Skip to content

Commit

Permalink
post_path and post_link use filename not post.title (#799)
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh authored and NoahDragon committed Nov 2, 2018
1 parent 547c5b2 commit 9c4beaf
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions source/docs/tag-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,32 @@ Inserts a responsive or specified size Vimeo video.
Include links to other posts.

```
{% post_path slug %}
{% post_link slug [title] %}
{% post_path filename %}
{% post_link filename [optional text] %}
```

You can ignore permalink and folder information, like languages and dates, when using this tag.

For instance: `{% raw %}{% post_link how-to-bake-a-cake %}{% endraw %}`.

This will work as long as the post has in the front matter `title: How to bake a cake`, even if the post is located at `source/posts/2015-02-my-family-holiday` and has permalink `2018/en/how-to-bake-a-cake`.
This will work as long as the filename of the post is `how-to-bake-a-cake.md`, even if the post is located at `source/posts/2015-02-my-family-holiday` and has permalink `2018/en/how-to-bake-a-cake`.

You can customize the text to display, instead of displaying the post's title. Using `post_path` inside Markdown syntax `[]()` is not supported.

For instance:

**Display title of the post.**

`{% raw %}{% post_link 2018-10-19-hexo-3-8-released %}{% endraw %}`

{% post_link 2018-10-19-hexo-3-8-released %}

**Display custom text.**

`{% raw %}{% post_link 2018-10-19-hexo-3-8-released 'Link to a post' %}{% endraw %}`

{% post_link 2018-10-19-hexo-3-8-released 'Link to a post' %}


## Include Assets

Expand Down

0 comments on commit 9c4beaf

Please sign in to comment.