https://github.com/grrowl/jekyll-titled-link
Plugin for Jekyll which adds a tag to display a link with its source's title
https://github.com/grrowl/jekyll-titled-link
Last synced: about 1 year ago
JSON representation
Plugin for Jekyll which adds a tag to display a link with its source's title
- Host: GitHub
- URL: https://github.com/grrowl/jekyll-titled-link
- Owner: grrowl
- Created: 2015-12-06T06:19:30.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-07T09:07:28.000Z (over 10 years ago)
- Last Synced: 2025-06-05T05:30:38.886Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Titled Link tag plugin for Jekyll
This plugin enables a Liquid tag which will automatically create links using the source location's title attribute. For example, a link to `https://github.com/` will display the text "GitHub · Where software is built".
Title detection is [(very) rudimentary](http://stackoverflow.com/a/1732454/894361), mostly to avoid a heavy requirement like nokogiri. If you come across a page title in the wild which doesn't work, please file an issue
# How To Install
1. Copy `titled_link.rb` into `/_plugins` or `/plugins`.
2. That is all.
# How To use
Place a `titled_link` tag in your content file, along with the URL, e.g.:
```
{% titled_link https://github.com %}
```
# Caching
To avoid downloading every linked page on rebuild, we cache the titles in a directory named `.link-cache`. It will never update after the initial check, but you can safely delete `.link-cache` to recreate it on next load, and refresh all link titles.
You can also use the `titled_linknocache` tag to bypasses the cache. This is not recommended since it will download every link on a page when it is regenerated.
# Author
Tom McKenzie -- http://chillidonut.com
# Credits
This code is adapted from [Tweet Tag](https://github.com/scottwb/jekyll-tweet-tag), which itself is inspired by the [Gist Tag](https://gist.github.com/1027674) plugin by Brandon Tilley and the
[oEmbed Tag](https://gist.github.com/1455726) by Tammo van Lessen.
# License
This code is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)