非常强大,它允许我直接发布博客。然而,我想为Twitter卡片添加
meta
。有没有什么方法可以实现这一点? client = pytumblr.TumblrRestClient(
app.config['CONSUMER_KEY'],
app.config['CONSUMER_SECRET'],
app.config['OAUTH_TOKEN'],
app.config['OAUTH_SECRET'],
)
if news.is_published:
body = ''
if news.image_url_list and len(news.image_url_list) > 0:
body = '<img src="{0}" /><br/>'.format(news.image_url_list[0])
slug = Slugify.slugify(news.head_line)
post = client.create_text("xxx.tumblr.com",
state="published",
tags=news.tag_list,
format='html',
slug=slug,
title=news.head_line,
body=body + news.summary.encode('utf-8'))
我该如何将这些元标签添加到博客文章中?
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@flickr" />
<meta name="twitter:title" content=? news.head_line ? />
<meta name="twitter:description" content=? news.description ? />
<meta name="twitter:image" content=? news.image_url_list[0] ? />