0 votes

MBran Open Graph

An Umbraco plugin which adds open graph metadata to Umbraco powered sites

1. Install the package either from Nuget or Umbraco package

2. Create a new data type from "MBran.OpenGraph" type

3. Add new property to your doctype and select the data type you have created from step#2.

4. Edit your page from the backoffice and fill the necessary details for the Open Graph. 

5. Save your changes.

4. Add the following snippet on your html template:

/* This will search for the first property that is of type MBran.OpenGraph */

@Html.OpenGraph()

OR

/* This will get the page property "docTypePropertyName" */

@Html.OpenGraph("docTypePropertyName")

 

5. Load your html page and view the code for metadata. It should look something like the below:

<meta property="og:title" content="My Website">

<meta property="og:type" content="website">

<meta property="og:description" content="This is  the description that will show  when sharing this link to  social media.">

<meta property="og:site_name" content="My site">

 

6. If you wish to have default values for opengraph metadata, you can pass an argument as an IEnumerable. The values specified on this argument will be overwritten by any matching key from the property value.

@Html.OpenGraph("docTypePropertyName", new []

{

    new { key = "og:site_name", value="My site" }

})

OR

@Html.OpenGraph("docTypePropertyName", new List<OpenGraphMetaData>

{

    new OpenGraphMetaData{ Key = "og:site_name", Value = "My site"}

})

Screenshots

Package owner

Mark Gil Libres

Mark Gil Libres

Mark has 108 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
8.0.x (untested)
7.12.x (100%)
7.11.x (100%)
7.10.x (100%)
7.9.x (100%)
7.8.x (100%)
7.7.x (100%)
7.6.x (untested)
7.5.x (untested)
7.4.x (untested)
7.3.x (untested)
7.2.x (untested)
7.1.x (untested)
7.0.x (untested)
6.1.x (untested)
6.0.x (untested)

You must login before you can report on package compatibility.

Package Information

  • Package owner: Mark Gil Libres
  • Created: 17/11/2018
  • Current version 1.0.0
  • .net Version 4.5.2
  • License MIT
  • Downloads: 15

External resources