Add support for SEO Pelican plugin
This commit is contained in:
parent
2fc69e12ef
commit
73bc9aac05
5 changed files with 79 additions and 69 deletions
|
@ -44,6 +44,7 @@ The minimalist [Pelican](http://blog.getpelican.com/) theme.
|
|||
- [Representative image](https://github.com/getpelican/pelican-plugins/tree/master/representative_image)
|
||||
- [Neighbors](https://github.com/getpelican/pelican-plugins/tree/master/neighbors)
|
||||
- [Tipue Search](https://github.com/getpelican/pelican-plugins/blob/master/tipue_search/)
|
||||
- [SEO](https://github.com/pelican-plugins/seo)
|
||||
|
||||
## Install
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@
|
|||
<meta name="msapplication-TileColor" content="{{ BROWSER_COLOR }}">
|
||||
{% endif %}
|
||||
|
||||
{% if not PLUGINS or 'seo' not in PLUGINS %}
|
||||
{% if REL_CANONICAL %}
|
||||
{% if page %}
|
||||
<link rel="canonical" href="{{ SITEURL }}/{{ page.url }}">
|
||||
|
@ -127,6 +128,8 @@
|
|||
<link rel="canonical" href="{{ SITEURL }}/{{ output_file }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% block meta %}
|
||||
<meta name="author" content="{{ AUTHOR }}" />
|
||||
<meta name="description" content="{{ SITEDESCRIPTION }}" />
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{% if SITELOGO %}
|
||||
{% if not PLUGINS or 'seo' not in PLUGINS %}
|
||||
{% if SITELOGO %}
|
||||
{% set default_cover = SITELOGO %}
|
||||
{% else %}
|
||||
{% else %}
|
||||
{% set default_cover = '{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/profile.png' %}
|
||||
{% endif %}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
{% endif %}
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
"name": "{{ article.title|striptags }}",
|
||||
|
@ -19,5 +20,6 @@
|
|||
"image": "{{ article.metadata.get('cover', default_cover) }}",
|
||||
"url": "{{ SITEURL }}/{{ article.url }}",
|
||||
"description": "{{ article.summary|striptags }}"
|
||||
}
|
||||
</script>
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
{% if OG_LOCALE %}
|
||||
{% if not PLUGINS or 'seo' not in PLUGINS %}
|
||||
{% if OG_LOCALE %}
|
||||
{% set default_locale = OG_LOCALE %}
|
||||
{% else %}
|
||||
{% else %}
|
||||
{% set default_locale = 'en_US' %}
|
||||
{% endif %}
|
||||
<meta property="og:site_name" content="{{ SITENAME }}"/>
|
||||
<meta property="og:type" content="blog"/>
|
||||
<meta property="og:title" content="{{ SITENAME }}"/>
|
||||
<meta property="og:description" content="{{ SITEDESCRIPTION }}"/>
|
||||
<meta property="og:locale" content="{{ default_locale }}"/>
|
||||
<meta property="og:url" content="{{ SITEURL }}"/>
|
||||
{% if SITELOGO %}
|
||||
<meta property="og:image" content="{{ SITELOGO }}">
|
||||
{% endif %}
|
||||
<meta property="og:site_name" content="{{ SITENAME }}"/>
|
||||
<meta property="og:type" content="blog"/>
|
||||
<meta property="og:title" content="{{ SITENAME }}"/>
|
||||
<meta property="og:description" content="{{ SITEDESCRIPTION }}"/>
|
||||
<meta property="og:locale" content="{{ default_locale }}"/>
|
||||
<meta property="og:url" content="{{ SITEURL }}"/>
|
||||
{% if SITELOGO %}
|
||||
<meta property="og:image" content="{{ SITELOGO }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
|
@ -1,23 +1,25 @@
|
|||
{% if OG_LOCALE %}
|
||||
{% if not PLUGINS or 'seo' not in PLUGINS %}
|
||||
{% if OG_LOCALE %}
|
||||
{% set default_locale = OG_LOCALE %}
|
||||
{% else %}
|
||||
{% else %}
|
||||
{% set default_locale = 'en_US' %}
|
||||
{% endif %}
|
||||
<meta property="og:site_name" content="{{ SITENAME }}"/>
|
||||
<meta property="og:title" content="{{ article.title|striptags|escape }}"/>
|
||||
<meta property="og:description" content="{{ article.summary|striptags|escape }}"/>
|
||||
<meta property="og:locale" content="{{ article.metadata.get('og_locale', default_locale) }}"/>
|
||||
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}"/>
|
||||
<meta property="og:type" content="article"/>
|
||||
<meta property="article:published_time" content="{{ article.date }}"/>
|
||||
<meta property="article:modified_time" content="{{ article.modified }}"/>
|
||||
<meta property="article:author" content="{{ SITEURL }}/{{ article.author.url }}">
|
||||
<meta property="article:section" content="{{ article.category.name }}"/>
|
||||
{% for tag in article.tags %}
|
||||
<meta property="article:tag" content="{{ tag.name|escape }}"/>
|
||||
{% endfor %}
|
||||
{% if 'cover' in article.metadata %}
|
||||
<meta property="og:image" content="{{ SITEURL }}/{{ article.metadata['cover'] }}">
|
||||
{% else %}
|
||||
<meta property="og:image" content="{{ SITELOGO }}">
|
||||
{% endif %}
|
||||
<meta property="og:site_name" content="{{ SITENAME }}"/>
|
||||
<meta property="og:title" content="{{ article.title|striptags|escape }}"/>
|
||||
<meta property="og:description" content="{{ article.summary|striptags|escape }}"/>
|
||||
<meta property="og:locale" content="{{ article.metadata.get('og_locale', default_locale) }}"/>
|
||||
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}"/>
|
||||
<meta property="og:type" content="article"/>
|
||||
<meta property="article:published_time" content="{{ article.date }}"/>
|
||||
<meta property="article:modified_time" content="{{ article.modified }}"/>
|
||||
<meta property="article:author" content="{{ SITEURL }}/{{ article.author.url }}">
|
||||
<meta property="article:section" content="{{ article.category.name }}"/>
|
||||
{% for tag in article.tags %}
|
||||
<meta property="article:tag" content="{{ tag.name|escape }}"/>
|
||||
{% endfor %}
|
||||
{% if 'cover' in article.metadata %}
|
||||
<meta property="og:image" content="{{ SITEURL }}/{{ article.metadata['cover'] }}">
|
||||
{% else %}
|
||||
<meta property="og:image" content="{{ SITELOGO }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue