Skip to content

Instantly share code, notes, and snippets.

@jvanasco
Created September 19, 2017 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jvanasco/430dcfc485e1b729399023111b346603 to your computer and use it in GitHub Desktop.
Save jvanasco/430dcfc485e1b729399023111b346603 to your computer and use it in GitHub Desktop.
lektor opengraph support
[model]
name = Page
label = {{ this.title }}
[fields.title]
label = Title
type = string
[fields.meta_title]
label = MetaData Title
type = string
[fields.meta_description]
label = MetaData Description
type = string
[fields.og_title]
label = OpenGraph Title
type = string
[fields.og_description]
label = OpenGraph Description
type = string
[fields.body]
label = Body
type = markdown
{% extends "site_layout.html" %}
{% block title %}{{ this.title }}{% endblock %}
{% block meta_title %}{{ this.meta_title or this.title }}{% endblock %}
{% block meta_description %}{{ this.meta_description }}{% endblock %}
{% block og_title %}{{ this.og_title or this.meta_title or this.title }}{% endblock %}
{% block og_description %}{{ this.og_description or this.meta_description }}{% endblock %}
{% block body %}
{{ this.body }}
{% endblock %}
<title>{% block title %}DEFAULT TITLE{% endblock %}</title>
<meta name="title" content="{% block meta_title %}{% endblock %}"/>
<meta name="description" content="{% block meta_description %}{% endblock %}"/>
<meta name="author" content="AUTHOR"/>
<link href="{{ this.url_path | url(external=True) }}" rel="canonical">
<meta property="og:title" content="{% block og_title %}{% endblock %}" />
<meta property="og:site_name" content="SITE NAME" />
<meta property="og:url" content="{{ this.url_path | url(external=True) }}" />
<meta property="og:description" content="{% block og_description %}{% endblock %}" />
<meta property="og:type" content="website" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment