added opengraph metadata

This commit is contained in:
James Shiffer 2020-09-02 20:44:57 -07:00
parent a0e654da2d
commit 054db8cdac
No known key found for this signature in database
GPG Key ID: C0DB8774A1B3BA45
3 changed files with 20 additions and 1 deletions

View File

@ -9,6 +9,7 @@ const ArticleSchema = new Schema({
ref: 'User'
},
slug: { type: String, index: { unique: true } },
description: { type: String, required: false },
image: { type: String, required: true },
created_at: { type: Date, default: Date.now },
updated_at: { type: Date },

View File

@ -171,7 +171,25 @@
<svelte:head>
<title>{article.title} | HOWFEED.BIZ</title>
<meta property="og:title" content={article.title}>
<meta property="og:type" content="article">
<meta property="og:locale" content="en_US">
<meta property="og:site_name" content="HowFeed">
<meta property="og:image" content={`https://howfeed.biz/a/${article.image}`}>
<meta property="og:url" content={`https://howfeed.biz/a/${article.slug}`}>
<meta property="article:published_time" content={new Date(article.created_at).toISOString()}>
{#if article.updated_at}
<meta property="article:modified_time" content={new Date(article.updated_at).toISOString()}>
{/if}
<meta property="article:author:first_name" content={article.author.realname.split(' ')[0]}>
<meta property="article:author:last_name" content={article.author.realname.split(' ').slice(1)}>
<meta property="article:section" content={article.category.name}>
<meta name="author" content={article.author.realname}>
{#if article.description}
<meta name="description" property="og:description" content={article.description}>
{/if}
{@html `<script type="application/ld+json">{
"@context": "https://schema.org",
"@type": "BreadcrumbList",

View File

@ -1,5 +1,5 @@
<!doctype html>
<html lang='en'>
<html lang='en' prefix='https://ogp.me/ns/article#'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width,initial-scale=1.0'>