<!-- templates/literary/seo.tpl -->
{if $current_category.name}
<title>{$current_category.name} - {$config.site.name}</title>
<meta name="description" content="{$current_category.name}是{$config.site.name}网站下的一个文章分类，拥有海量与{$current_category.name}相关的文章和文学创作。{$current_category.description}">
<meta name="keywords" content="{$current_category.name},{$config.site.name},文学,文章,创作">
{elseif $post.title}
<title>{if $pagination.page}第{$pagination.page}页 - {/if}{$post.title} - {$post.category} - {$config.site.name}</title>
{if $post.content}
{assign var="intro" value=$post.content|strip_tags|replace:'  ':' '|truncate:150:""}
{/if}
<meta name="description" content="{$post.title}是一篇与{$post.category}相关的优质文章，作者是{$post.author}，文章简介：{$intro}">
<meta name="keywords" content="{$post.title},{$post.category},{$config.site.name},文学创作">
{elseif $mod == 'search' && $keyword}
<title>搜索"{$keyword}"的结果 - {$config.site.name}</title>
<meta name="description" content="在{$config.site.name}中搜索关键词'{$keyword}'的结果，找到相关文章{$pagination.total|default:0}篇。">
<meta name="keywords" content="{$keyword},搜索,{$config.site.name}">
{elseif $mod == 'author' && $author_name}
<title>{$author_name}的文章 - {$config.site.name}</title>
<meta name="description" content="浏览{$author_name}在{$config.site.name}发布的所有文章，共{$pagination.total|default:0}篇文学创作。">
<meta name="keywords" content="{$author_name},作者,{$config.site.name}">
{else}
<title>{$config.site.name} - 文学创作分享平台</title>
<meta name="description" content="{$config.site.description}">
<meta name="keywords" content="{$config.site.keywords}">
{/if}

<!-- Open Graph 标签 -->
<meta property="og:type" content="website">
<meta property="og:site_name" content="{$config.site.name}">
{if $post.title}
<meta property="og:title" content="{$post.title} - {$config.site.name}">
<meta property="og:description" content="{$intro|default:$config.site.description}">
{else}
<meta property="og:title" content="{$config.site.name}">
<meta property="og:description" content="{$config.site.description}">
{/if}
<meta property="og:url" content="{build_url mod=$mod}">

<!-- Twitter 卡片 -->
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="{if $post.title}{$post.title} - {$config.site.name}{else}{$config.site.name}{/if}">
<meta name="twitter:description" content="{$intro|default:$config.site.description}">

<!-- 规范链接 -->
{if $post.title}
<link rel="canonical" href="{build_url mod='post' id=$post.id}">
{else}
<link rel="canonical" href="{build_url mod=$mod}">
{/if}