Improve SEO
This commit is contained in:
@@ -1,43 +1,15 @@
|
||||
{# {% import 'pcs/comments.html' as pcs with context %} #}
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block html_lang %}{{ article.lang }}{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
<meta name="author" content="{{ article.author }}">
|
||||
<meta name="keywords" content="{{ article.tags|join(',')|escape }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block head %}
|
||||
{% block title %}
|
||||
<title>{{ article.title }} - {{SITENAME}}</title>
|
||||
{% endblock %}
|
||||
{{ super() }}
|
||||
{% import 'translations.html' as translations with context %}
|
||||
{% if translations.entry_hreflang(article) %}
|
||||
{{ translations.entry_hreflang(article) }}
|
||||
{% endif %}
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<meta property="og:title" content="{{ article.title }}">
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}">
|
||||
<meta property="article:published_time" content="{{ article.date.isoformat() }}">
|
||||
{% if article.modified %}
|
||||
<meta property="article:modified_time" content="{{ article.modified.isoformat() }}">
|
||||
{% endif %}
|
||||
<meta property="article:section" content="{{ article.category }}">
|
||||
{% set OG_DESC_LENGTH = 175 %}
|
||||
{% if og_description|length >= OG_DESC_LENGTH %}
|
||||
{# Quita la última palabra para no dejarla incompleta #}
|
||||
{% set og_description = og_description[:OG_DESC_LENGTH].split(' ')[:-1]|join(' ') %}
|
||||
{% if not og_description[-1] in ['.', '?', ':', '!'] %}
|
||||
{% set og_description = og_description + '…' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<meta property="og:description" content="{{ og_description }}">
|
||||
{% if article.image %}
|
||||
<meta property="og:image" content="{{ article.image.split('"')[1] }}">
|
||||
{% endif %}
|
||||
{% for tag in article.tags %}
|
||||
<meta property="og:tag" content="{{ tag | escape }}">
|
||||
{% endfor %}
|
||||
|
||||
{% if article.styles %}
|
||||
{% for style in article.styles %}
|
||||
@@ -51,12 +23,45 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% block seo %}
|
||||
{% set seo_description = article.summary|striptags %}
|
||||
{% set SEO_DESC_LENGTH = 175 %}
|
||||
{% if seo_description|length >= SEO_DESC_LENGTH %}
|
||||
{# Quita la última palabra para no dejarla incompleta #}
|
||||
{% set seo_description = seo_description[:SEO_DESC_LENGTH].split(' ')[:-1]|join(' ') %}
|
||||
{% if not seo_description[-1] in ['.', '?', ':', '!'] %}
|
||||
{% set seo_description = seo_description + '…' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<!-- Meta Article -->
|
||||
<meta name="author" content="{{ article.author.name }}" />
|
||||
<meta name="description" content="{{ seo_description }}" />
|
||||
<meta name="keywords" content="{{ article.tags|join(', ') }}">
|
||||
<meta property="article:author" content="{{ article.author }}" />
|
||||
<meta property="article:section" content="{{ article.category }}" />
|
||||
<meta property="article:published_time" content="{{ article.date.strftime("%Y-%m-%d-T%H-%M-%S") }}"/>
|
||||
{% if article.modified %}
|
||||
<meta property="article:modified_time" content="{{ article.modified.isoformat() }}">
|
||||
{% endif %}
|
||||
|
||||
<!-- OpenGraph -->
|
||||
<meta property="og:type" content="article"/>
|
||||
<meta property="og:tag" content="{{ article.tags|join(',')|escape }}"/>
|
||||
<meta property="og:title" content="{{ article.title }} - {{ SITENAME }}"/>
|
||||
<meta property="og:description" content="{{ seo_description }}"/>
|
||||
<meta property="og:site_name" content="{{ SITENAME }}"/>
|
||||
<meta property="og:url" content="{{ SITEURL }}/{{ article.url }}"/>
|
||||
<meta property="og:image" content="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/../wp-content/uploads/article/poster/{{ article.image }}"/>
|
||||
|
||||
<!-- Twitter -->
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:title" content="{{ article.title }} - {{ SITENAME }}">
|
||||
<meta name="twitter:description" content="{{ seo_description }}">
|
||||
<meta name="twitter:url" content="{{ SITEURL }}/{{ article.url }}">
|
||||
<meta name="twitter:image" content="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/../wp-content/uploads/article/poster/{{ article.image }}">
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
{% block title %}{{ article.title|striptags }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<!-- start of posts -->
|
||||
@@ -116,49 +121,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<!-- post footer nav -->
|
||||
<div class="columns">
|
||||
<div class="column has-text-left">
|
||||
<a class="button is-small is-button-grey" href="{{ SITEURL }}/">{{ _('Regresar al Inicio') }}</a>
|
||||
</div>
|
||||
<div class="column has-text-right">
|
||||
<span class="soumaicon">
|
||||
<svg>
|
||||
<use href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/icons/master.svg#calendar" />
|
||||
</svg>
|
||||
</span>
|
||||
{% set año = article.date|strftime('%Y') %}
|
||||
{% set mes = article.date|strftime('%m') %}
|
||||
{% set nombre_mes = article.date|strftime('%B') %}
|
||||
<time class="entry-date published"
|
||||
datetime="{{ article.date.isoformat() }}">
|
||||
<small>
|
||||
{{ article.date|strftime('%a %-d') }}
|
||||
<a href="{{ SITEURL }}/archives/{{ año }}/{{ mes }}/"
|
||||
title="{% trans %}Artículos de {{ nombre_mes }} de {{ año }}{% endtrans %}">
|
||||
{{ nombre_mes }}
|
||||
</a>
|
||||
<a href="{{ SITEURL }}/archives/{{ año }}/"
|
||||
title="{% trans %}Artículos de {{ año }}{% endtrans %}">{{ año }}
|
||||
</a>
|
||||
</small>
|
||||
</time>
|
||||
|
||||
{% if not HIDE_AUTHORS and article.authors %}
|
||||
<span class="soumaicon">
|
||||
<svg>
|
||||
<use href="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/images/icons/master.svg#user"/>
|
||||
</svg>
|
||||
</span>
|
||||
{% for author in article.authors %}
|
||||
<small>
|
||||
<a href="{{ SITEURL }}/{{ author.url }}"
|
||||
title="{% trans %}Autor del artículo{% endtrans %}">{{ author }}</a>{% if not loop.last %}, {% endif %}
|
||||
</small>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% include 'article_info.html' %}
|
||||
<!-- end of post footer nav -->
|
||||
</div>
|
||||
<!-- end of post footer -->
|
||||
@@ -214,8 +177,9 @@
|
||||
<p><strong>{{ comment.author }}</strong></p>
|
||||
{% endif %}
|
||||
{{ comment.content }}
|
||||
<small><a href="{{ SITEURL }}/{{ article.url }}#comment-{{comment.slug}}">Permalink</a>
|
||||
| {{ comment.date }}</small>
|
||||
<small><a href="{{ SITEURL }}/{{ article.url }}#comment-{{comment.slug}}" title='Permalink'>
|
||||
<abbr title='{{ comment.date|strftime("%Y-%m-%d-T%H-%M-%S") }}'>{{ _('Permalink') }}</abbr>
|
||||
</a> | {{ comment.date|strftime("%H:%M:%S") }}</small>
|
||||
</div>
|
||||
</div>
|
||||
<!-- end of comment content -->
|
||||
|
||||
Reference in New Issue
Block a user