Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite59acbd

Browse files
committed
add guidance on metadata
1 parenta4d7c0b commite59acbd

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

‎README.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,36 @@ Uses Jinja2 templating.
4444
They are pulled from GitHub by just loading
4545
whatever URL to our main profile page is.
4646

47+
###Metadata
48+
Most forums and social networks nowadays can use fancy card views with a
49+
title, a description and an image, which serves as a link preview. For the
50+
card preview to work, the`<head>` section must include some metadata fields.
51+
52+
The most important fields have been configured for all pages with some
53+
defaults and they can be overwritten from more specific templates. See
54+
`templates/layout.html` for info on how to set the metadata and the defaults
55+
used.
56+
57+
`og_title`,`og_description` and`og_image` block can be used to modify the default title
58+
description and image in the card respectively. Here is one example from the
59+
teammates template:
60+
61+
```html
62+
<!-- layout sets the metadata defaults and blocks to modify it-->
63+
{% extends "layout.html" %}
64+
<!-- Use og_title to modify the default "PyMC Labs" as title-->
65+
<!-- Note that this only affects the card title, not the title shown by the browser-->
66+
{% block og_title %}{{ this.name }} - PyMC Labs{% endblock %}
67+
<!-- Use og_title to modify the default "Bespoke Bayesian Modeling" as description-->
68+
{% block og_description %}{{ this.blurb|string }}{% endblock %}
69+
```
70+
71+
See more on possible metadata fields[here](https://ogp.me/). Moreover,
72+
Twitter is extremely picky and in addition to being the most restrictive in
73+
general, also requires an extra line to choose between the`summary` or
74+
`summary_large_image` card types. For now all pages use`summary` format, but
75+
this could be modified or left to configure for each page if desired.
76+
4777
###Other stuff to edit?
4878

4979
Consult:

‎templates/layout.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z"crossorigin="anonymous">
1919

2020
<title>PyMC Labs</title>
21+
<metaname="twitter:card"content="summary">
2122
<metaproperty="og:url"content="{{ this|url(external=true) }}"/>
2223
<metaproperty="og:type"content="website"/>
2324
<metaproperty="og:title"content="{% block og_title%}PyMC Labs{% endblock %}"/>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp