A plugin to expose meta data information from the head tag of a webapge to liquid variables just from its url string.

jekyll, jekyll-plugin, ruby
gem install jekyll-url-metadata -v 1.0.1



A jekyll plugin to extract meta information from urls and expose them to liquid variables.

This gem was originally authored to be used as a custom plugin for the static site of


Add this line to your application's Gemfile inside the jekyll_plugins group:

group :jekyll_plugins do
    # other gems
    gem "jekyll-url-metadata"

Then, enable the plugin by adding it to the plugins section in the _config.yml file:

    # - other plugins
    - jekyll-url-metadata

And then execute:

bundle install


This plugin is essentially a filter and works on any valid URL string provided inside a liquid tag. Use it as below:

{% assign meta = "" | metadata %}

The metadata filter extracts the meta data from the given url string.

These are the values that are extracted:

  • The <title> tag.
  • The <meta> tags that have a name, property or charset fields.
  • The <link> tags with a rel attribute.

The expected output for {{ meta }} from the above example would be:

  "title" => "Wikipedia",
  "charset" => "utf-8",
  "description" => "Wikipedia is a free online encyclopedia, created and edited by volunteers around the world and hosted by the Wikimedia Foundation.",
  "viewport" => "initial-scale=1,user-scalable=yes",
  "apple-touch-icon" => "/static/apple-touch/wikipedia.png",
  "shortcut icon" => "/static/favicon/wikipedia.ico",
  "license" => "//",
  "preconnect" => "//"

Use cases

  • Creating beautiful social previews for links by fetching meta data for URLs at build time.
  • Determining meta data from a website at jekyll build time to evaluate and perform certain action.


The gem is available as open source under the terms of the MIT License.