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

 Download package
version 1.0.0

NuGet install instructions for Umbraco 7.7.0-7.12.0

Install-Package MBran.OpenGraph

Package owner

Mark Gil Libres

Mark Gil Libres

Mark has 113 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
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions: 7.12.x, 7.11.x, 7.10.x, 7.9.x, 7.8.x, 7.7.x

Package Information

  • Package owner: Mark Gil Libres
  • Created: 17/11/2018
  • Current version 1.0.0
  • .NET version 4.5.2
  • License MIT
  • Downloads on Our: 170
  • Downloads on NuGet: 844
  • Total downloads : 1K

External resources