leven-the-blog / leven

😋 Make your own blog!
56 stars 6 forks source link

Add SEO Metadata. #16

Open sidney-pham opened 7 years ago

sidney-pham commented 7 years ago

Ghost does it by letting users set 'Meta Title' and 'Meta Description'. This is what the <head> of a blog post looks like for reference, with Meta Title = 'A Cow - Sidney Pham' and Meta Description = 'Cows':

<head>
    <meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <title>A Cow - Sidney Pham</title>

    <meta name="HandheldFriendly" content="True" />
    <meta name="MobileOptimized" content="320" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="stylesheet" type="text/css" href="/assets/css/normalize.css?v=467ef9cd4a" />
    <link rel="stylesheet" type="text/css" href="/assets/css/nprogress.css?v=467ef9cd4a" />
    <link rel="stylesheet" type="text/css" href="/assets/css/style.css?v=467ef9cd4a" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,600,700,300&subset=latin,cyrillic-ext,latin-ext,cyrillic" />
    <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
    <!-- <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet"> -->

    <meta name="description" content="Cows" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="canonical" href="http://sidneypham.me/an-xor-trick/" />
    <meta name="referrer" content="no-referrer-when-downgrade" />
    <link rel="amphtml" href="http://sidneypham.me/an-xor-trick/amp/" />

    <meta property="og:site_name" content="Sidney Pham - Blog" />
    <meta property="og:type" content="article" />
    <meta property="og:title" content="A Cow - Sidney Pham" />
    <meta property="og:description" content="Cows" />
    <meta property="og:url" content="http://sidneypham.me/an-xor-trick/" />
    <meta property="article:published_time" content="2017-10-13T07:16:31.000Z" />
    <meta property="article:modified_time" content="2017-10-26T02:50:36.000Z" />
    <meta property="article:tag" content="coding" />
    <meta property="article:tag" content="algorithms" />

    <meta name="twitter:card" content="summary" />
    <meta name="twitter:title" content="A Cow - Sidney Pham" />
    <meta name="twitter:description" content="Cows" />
    <meta name="twitter:url" content="http://sidneypham.me/an-xor-trick/" />
    <meta name="twitter:label1" content="Written by" />
    <meta name="twitter:data1" content="Sidney Pham" />
    <meta name="twitter:label2" content="Filed under" />
    <meta name="twitter:data2" content="coding, algorithms" />

    <script type="application/ld+json">
{
    "@context": "https://schema.org",
    "@type": "Article",
    "publisher": {
        "@type": "Organization",
        "name": "Sidney Pham - Blog",
        "logo": {
            "@type": "ImageObject",
            "url": "http://sidneypham.me/favicon.ico",
            "width": 60,
            "height": 60
        }
    },
    "author": {
        "@type": "Person",
        "name": "Sidney Pham",
        "url": "http://sidneypham.me/author/sidney/",
        "sameAs": []
    },
    "headline": "A Cow - Sidney Pham",
    "url": "https://sidneypham.me/an-xor-trick/",
    "datePublished": "2017-10-13T07:16:31.000Z",
    "dateModified": "2017-10-26T02:50:36.000Z",
    "keywords": "coding, algorithms",
    "description": "Cows",
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "http://sidneypham.me/"
    }
}
    </script>

    <meta name="generator" content="Ghost 1.7" />
    <link rel="alternate" type="application/rss+xml" title="Sidney Pham - Blog" href="https://sidneypham.me/rss/" />
</head>
quadrupleslap commented 7 years ago

What special support do you need for this? It sounds like something a template would do, but I can add an auto-tldr and/or a manual tldr if you think it's necessary.