-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55613f8
commit 34686c4
Showing
12 changed files
with
192 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Opw.PineBlog.RazorPages/Areas/Blog/Pages/Shared/_Metadata.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@model Opw.PineBlog.RazorPages.Models.MetadataModel | ||
@if (!string.IsNullOrWhiteSpace(Model.Author)) | ||
{ | ||
<meta name="author" content="@Model.Author"> | ||
} | ||
@if (Model.Keywords.Any()) | ||
{ | ||
<meta name="keywords" content="@string.Join(",", Model.Keywords)"> | ||
} | ||
@if (!string.IsNullOrWhiteSpace(Model.Description)) | ||
{ | ||
<meta name="Description" content="@Model.Description"> | ||
<meta property="og:description " content="@Model.Description" /> | ||
} | ||
@if (!string.IsNullOrWhiteSpace(Model.Title)) | ||
{ | ||
<meta property="og:title" content="@Model.Title" /> | ||
} | ||
@if (!string.IsNullOrWhiteSpace(Model.Type)) | ||
{ | ||
<meta property="og:type" content="@Model.Type" /> | ||
if (Model.Type == "article") | ||
{ | ||
@if (Model.Published.HasValue) | ||
{ | ||
<meta name="article:published_time" content="@Model.Published.Value.ToUtc()"> | ||
} | ||
@if (!string.IsNullOrWhiteSpace(Model.Author)) | ||
{ | ||
<meta name="article:author" content="@Model.Author"> | ||
} | ||
@foreach (var tag in Model.Keywords) | ||
{ | ||
<meta name="article:tag" content="@tag"> | ||
} | ||
} | ||
} | ||
@if (!string.IsNullOrWhiteSpace(Model.Url)) | ||
{ | ||
<meta property="og:url" content="@Model.Url" /> | ||
} | ||
@if (!string.IsNullOrWhiteSpace(Model.Image)) | ||
{ | ||
<meta property="og:image" content="@Model.Image" /> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace Opw.PineBlog.RazorPages.Models | ||
{ | ||
/// <summary> | ||
/// Model for the _Metadata partial view. | ||
/// </summary> | ||
public class MetadataModel | ||
{ | ||
/// <summary> | ||
/// The title of your object as it should appear within the graph, e.g., "The Rock". | ||
/// </summary> | ||
public string Title { get; set; } | ||
|
||
/// <summary> | ||
/// The description of the page. | ||
/// </summary> | ||
public string Description { get; set; } | ||
|
||
/// <summary> | ||
/// The keywords for search engines. | ||
/// </summary> | ||
public IEnumerable<string> Keywords { get; set; } = new List<string>(); | ||
|
||
/// <summary> | ||
/// The published date, when Type is "article". | ||
/// </summary> | ||
public DateTime? Published { get; set; } | ||
|
||
/// <summary> | ||
/// The author of the page. | ||
/// </summary> | ||
public string Author { get; set; } | ||
|
||
/// <summary> | ||
/// The type of your object, e.g., "video.movie". | ||
/// </summary> | ||
public string Type { get; set; } | ||
|
||
/// <summary> | ||
/// An image URL which should represent your object within the graph. | ||
/// </summary> | ||
public string Image { get; set; } | ||
|
||
/// <summary> | ||
/// The canonical URL of your object that will be used as its permanent ID in the graph, e.g., "http://www.imdb.com/title/tt0117500/". | ||
/// </summary> | ||
public string Url { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters