Merge pull request #267 from MaevaBrunelles/support-seo-plugin
Add support for SEO Pelican plugin
This commit is contained in:
commit
21dd3f677b
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)
|
- [Representative image](https://github.com/getpelican/pelican-plugins/tree/master/representative_image)
|
||||||
- [Neighbors](https://github.com/getpelican/pelican-plugins/tree/master/neighbors)
|
- [Neighbors](https://github.com/getpelican/pelican-plugins/tree/master/neighbors)
|
||||||
- [Tipue Search](https://github.com/getpelican/pelican-plugins/blob/master/tipue_search/)
|
- [Tipue Search](https://github.com/getpelican/pelican-plugins/blob/master/tipue_search/)
|
||||||
|
- [SEO](https://github.com/pelican-plugins/seo)
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
|
|
@ -114,19 +114,22 @@
|
||||||
<meta name="msapplication-TileColor" content="{{ BROWSER_COLOR }}">
|
<meta name="msapplication-TileColor" content="{{ BROWSER_COLOR }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if REL_CANONICAL %}
|
{% if not PLUGINS or 'seo' not in PLUGINS %}
|
||||||
{% if page %}
|
{% if REL_CANONICAL %}
|
||||||
<link rel="canonical" href="{{ SITEURL }}/{{ page.url }}">
|
{% if page %}
|
||||||
{% elif article %}
|
<link rel="canonical" href="{{ SITEURL }}/{{ page.url }}">
|
||||||
<link rel="canonical" href="{{ SITEURL }}/{{ article.url }}">
|
{% elif article %}
|
||||||
{% elif page_name == 'index' and not articles_previous_page %}
|
<link rel="canonical" href="{{ SITEURL }}/{{ article.url }}">
|
||||||
<link rel="canonical" href="{{ SITEURL }}/">
|
{% elif page_name == 'index' and not articles_previous_page %}
|
||||||
{% elif author or category or tag or page_name == 'index' %}
|
<link rel="canonical" href="{{ SITEURL }}">
|
||||||
<link rel="canonical" href="{{ SITEURL }}/{{ articles_page.url }}">
|
{% elif author or category or tag or page_name == 'index' %}
|
||||||
{% else %}
|
<link rel="canonical" href="{{ SITEURL }}/{{ articles_page.url }}">
|
||||||
<link rel="canonical" href="{{ SITEURL }}/{{ output_file }}">
|
{% else %}
|
||||||
|
<link rel="canonical" href="{{ SITEURL }}/{{ output_file }}">
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% block meta %}
|
{% block meta %}
|
||||||
<meta name="author" content="{{ AUTHOR }}" />
|
<meta name="author" content="{{ AUTHOR }}" />
|
||||||
<meta name="description" content="{{ SITEDESCRIPTION }}" />
|
<meta name="description" content="{{ SITEDESCRIPTION }}" />
|
||||||
|
|
|
@ -1,23 +1,25 @@
|
||||||
{% if SITELOGO %}
|
{% if not PLUGINS or 'seo' not in PLUGINS %}
|
||||||
{% set default_cover = SITELOGO %}
|
{% if SITELOGO %}
|
||||||
{% else %}
|
{% set default_cover = SITELOGO %}
|
||||||
{% set default_cover = '{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/profile.png' %}
|
{% else %}
|
||||||
|
{% set default_cover = '{{ SITEURL }}/{{ THEME_STATIC_DIR }}/img/profile.png' %}
|
||||||
|
{% endif %}
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "http://schema.org",
|
||||||
|
"@type": "BlogPosting",
|
||||||
|
"name": "{{ article.title|striptags }}",
|
||||||
|
"headline": "{{ article.title|striptags }}",
|
||||||
|
"datePublished": "{{ article.date }}",
|
||||||
|
"dateModified": "{{ article.modified }}",
|
||||||
|
"author": {
|
||||||
|
"@type": "Person",
|
||||||
|
"name": "{{ article.author.name }}",
|
||||||
|
"url": "{{ SITEURL }}/{{ article.author.url }}"
|
||||||
|
},
|
||||||
|
"image": "{{ article.metadata.get('cover', default_cover) }}",
|
||||||
|
"url": "{{ SITEURL }}/{{ article.url }}",
|
||||||
|
"description": "{{ article.summary|striptags }}"
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<script type="application/ld+json">
|
|
||||||
{
|
|
||||||
"@context": "http://schema.org",
|
|
||||||
"@type": "BlogPosting",
|
|
||||||
"name": "{{ article.title|striptags }}",
|
|
||||||
"headline": "{{ article.title|striptags }}",
|
|
||||||
"datePublished": "{{ article.date }}",
|
|
||||||
"dateModified": "{{ article.modified }}",
|
|
||||||
"author": {
|
|
||||||
"@type": "Person",
|
|
||||||
"name": "{{ article.author.name }}",
|
|
||||||
"url": "{{ SITEURL }}/{{ article.author.url }}"
|
|
||||||
},
|
|
||||||
"image": "{{ article.metadata.get('cover', default_cover) }}",
|
|
||||||
"url": "{{ SITEURL }}/{{ article.url }}",
|
|
||||||
"description": "{{ article.summary|striptags }}"
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
{% if OG_LOCALE %}
|
{% if not PLUGINS or 'seo' not in PLUGINS %}
|
||||||
{% set default_locale = OG_LOCALE %}
|
{% if OG_LOCALE %}
|
||||||
{% else %}
|
{% set default_locale = OG_LOCALE %}
|
||||||
{% set default_locale = 'en_US' %}
|
{% else %}
|
||||||
{% endif %}
|
{% set default_locale = 'en_US' %}
|
||||||
<meta property="og:site_name" content="{{ SITENAME }}"/>
|
{% endif %}
|
||||||
<meta property="og:type" content="blog"/>
|
<meta property="og:site_name" content="{{ SITENAME }}"/>
|
||||||
<meta property="og:title" content="{{ SITENAME }}"/>
|
<meta property="og:type" content="blog"/>
|
||||||
<meta property="og:description" content="{{ SITEDESCRIPTION }}"/>
|
<meta property="og:title" content="{{ SITENAME }}"/>
|
||||||
<meta property="og:locale" content="{{ default_locale }}"/>
|
<meta property="og:description" content="{{ SITEDESCRIPTION }}"/>
|
||||||
<meta property="og:url" content="{{ SITEURL }}"/>
|
<meta property="og:locale" content="{{ default_locale }}"/>
|
||||||
{% if SITELOGO %}
|
<meta property="og:url" content="{{ SITEURL }}"/>
|
||||||
<meta property="og:image" content="{{ SITELOGO }}">
|
{% if SITELOGO %}
|
||||||
|
<meta property="og:image" content="{{ SITELOGO }}">
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,23 +1,25 @@
|
||||||
{% if OG_LOCALE %}
|
{% if not PLUGINS or 'seo' not in PLUGINS %}
|
||||||
{% set default_locale = OG_LOCALE %}
|
{% if OG_LOCALE %}
|
||||||
{% else %}
|
{% set default_locale = OG_LOCALE %}
|
||||||
{% set default_locale = 'en_US' %}
|
{% else %}
|
||||||
{% endif %}
|
{% set default_locale = 'en_US' %}
|
||||||
<meta property="og:site_name" content="{{ SITENAME }}"/>
|
{% endif %}
|
||||||
<meta property="og:title" content="{{ article.title|striptags|escape }}"/>
|
<meta property="og:site_name" content="{{ SITENAME }}"/>
|
||||||
<meta property="og:description" content="{{ article.summary|striptags|escape }}"/>
|
<meta property="og:title" content="{{ article.title|striptags|escape }}"/>
|
||||||
<meta property="og:locale" content="{{ article.metadata.get('og_locale', default_locale) }}"/>
|
<meta property="og:description" content="{{ article.summary|striptags|escape }}"/>
|
||||||
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}"/>
|
<meta property="og:locale" content="{{ article.metadata.get('og_locale', default_locale) }}"/>
|
||||||
<meta property="og:type" content="article"/>
|
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}"/>
|
||||||
<meta property="article:published_time" content="{{ article.date }}"/>
|
<meta property="og:type" content="article"/>
|
||||||
<meta property="article:modified_time" content="{{ article.modified }}"/>
|
<meta property="article:published_time" content="{{ article.date }}"/>
|
||||||
<meta property="article:author" content="{{ SITEURL }}/{{ article.author.url }}">
|
<meta property="article:modified_time" content="{{ article.modified }}"/>
|
||||||
<meta property="article:section" content="{{ article.category.name }}"/>
|
<meta property="article:author" content="{{ SITEURL }}/{{ article.author.url }}">
|
||||||
{% for tag in article.tags %}
|
<meta property="article:section" content="{{ article.category.name }}"/>
|
||||||
<meta property="article:tag" content="{{ tag.name|escape }}"/>
|
{% for tag in article.tags %}
|
||||||
{% endfor %}
|
<meta property="article:tag" content="{{ tag.name|escape }}"/>
|
||||||
{% if 'cover' in article.metadata %}
|
{% endfor %}
|
||||||
<meta property="og:image" content="{{ SITEURL }}/{{ article.metadata['cover'] }}">
|
{% if 'cover' in article.metadata %}
|
||||||
{% else %}
|
<meta property="og:image" content="{{ SITEURL }}/{{ article.metadata['cover'] }}">
|
||||||
<meta property="og:image" content="{{ SITELOGO }}">
|
{% else %}
|
||||||
|
<meta property="og:image" content="{{ SITELOGO }}">
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue