kristoffer1lundberg / ogcrawler
Fetches some basic OpenGraph data from a URL.
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:craft-plugin
Requires
- craftcms/cms: ^3.0.0-RC1
This package is not auto-updated.
Last update: 2024-09-26 00:38:58 UTC
README
Fetches some basic OpenGraph data from a URL and makes it accessible from a Twig variable.
Requirements
This plugin requires Craft CMS 3.0.0 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require kristoffer1lundberg/ogcrawler
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for ogCrawler.
Usage
{# Check OpenGraph data from a URL #} {# If unsuccessful, your variable will return false #} {% set ogData = craft.ogCrawler.getUrl('http://www.imdb.com/title/tt0056732/') %} {% if ogData %} Print some data here, for example: {% if ogData.image is defined %} <img src="{{ ogData.image }}" alt=""> {% endif %} {% endif %}
Available properties
description
image
site_name
title
type
Credit
Based on the OpenGraph Protocol Helper by Scott MacVicar