fix default theme

This commit is contained in:
joyqi 2023-12-29 11:50:38 +08:00
parent f1937a3a7c
commit 6b2c5b19e1
6 changed files with 57 additions and 88 deletions

View File

@ -1,45 +0,0 @@
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $this->need('header.php'); ?>
<div class="col-mb-12 col-8" id="main" role="main">
<h3 class="archive-title"><?php $this->archiveTitle([
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
], '', ''); ?></h3>
<?php if ($this->have()): ?>
<?php while ($this->next()): ?>
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<h2 class="post-title" itemprop="name headline"><a itemprop="url"
href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
</h2>
<ul class="post-meta">
<li itemprop="author" itemscope itemtype="http://schema.org/Person"><?php _e('作者: '); ?><a
itemprop="name" href="<?php $this->author->permalink(); ?>"
rel="author"><?php $this->author(); ?></a></li>
<li><?php _e('时间: '); ?>
<time datetime="<?php $this->date('c'); ?>"
itemprop="datePublished"><?php $this->date(); ?></time>
</li>
<li><?php _e('分类: '); ?><?php $this->category(','); ?></li>
<li itemprop="interactionCount"><a
href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('评论', '1 条评论', '%d 条评论'); ?></a>
</li>
</ul>
<div class="post-content" itemprop="articleBody">
<?php $this->content('- 阅读剩余部分 -'); ?>
</div>
</article>
<?php endwhile; ?>
<?php else: ?>
<article class="post">
<h2 class="post-title"><?php _e('没有找到内容'); ?></h2>
</article>
<?php endif; ?>
<?php $this->pageNav('&laquo; 前一页', '后一页 &raquo;'); ?>
</div><!-- end #main -->
<?php $this->need('sidebar.php'); ?>
<?php $this->need('footer.php'); ?>

View File

@ -6,7 +6,7 @@
<?php $comments->listComments(); ?>
<?php $comments->pageNav('&laquo; 前一页', '后一页 &raquo;'); ?>
<?php $comments->pageNav(); ?>
<?php endif; ?>
@ -19,7 +19,7 @@
<h3 id="response"><?php _e('添加新评论'); ?></h3>
<form method="post" action="<?php $this->commentUrl() ?>" id="comment-form" role="form">
<?php if ($this->user->hasLogin()): ?>
<p><?php _e('登录身份: '); ?><a
<p><?php _e('登录身份'); ?>: <a
href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a
href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> &raquo;</a>
</p>

View File

@ -29,6 +29,39 @@ function themeConfig($form)
$form->addInput($sidebarBlock->multiMode());
}
function postMeta(
\Widget\Archive $archive,
string $metaType = 'archive'
)
{
$titleTag = $metaType == 'archive' ? 'h2' : 'h1';
?>
<<?php echo $titleTag ?> class="post-title" itemprop="name headline">
<a itemprop="url"
href="<?php $archive->permalink() ?>"><?php $archive->title() ?></a>
</<?php echo $titleTag ?>>
<?php if ($metaType != 'page'): ?>
<ul class="post-meta">
<li itemprop="author" itemscope itemtype="http://schema.org/Person">
<?php _e('作者'); ?>: <a itemprop="name"
href="<?php $archive->author->permalink(); ?>"
rel="author"><?php $archive->author(); ?></a>
</li>
<li><?php _e('时间'); ?>:
<time datetime="<?php $archive->date('c'); ?>" itemprop="datePublished"><?php $archive->date(); ?></time>
</li>
<li><?php _e('分类'); ?>: <?php $archive->category(','); ?></li>
<?php if ($metaType == 'archive'): ?>
<li itemprop="interactionCount">
<a itemprop="discussionUrl"
href="<?php $archive->permalink() ?>#comments"><?php $archive->commentsNum('评论', '1 条评论', '%d 条评论'); ?></a>
</li>
<?php endif; ?>
</ul>
<?php endif; ?>
<?php
}
/*
function themeFields($layout)
{

View File

@ -13,32 +13,30 @@ $this->need('header.php');
?>
<div class="col-mb-12 col-8" id="main" role="main">
<?php if (!($this->is('index')) and !($this->is('post'))): ?>
<h3 class="archive-title"><?php $this->archiveTitle([
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
], '', ''); ?></h3>
<?php endif; ?>
<?php if ($this->have()): ?>
<?php while ($this->next()): ?>
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<h2 class="post-title" itemprop="name headline">
<a itemprop="url"
href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
</h2>
<ul class="post-meta">
<li itemprop="author" itemscope itemtype="http://schema.org/Person"><?php _e('作者: '); ?><a
itemprop="name" href="<?php $this->author->permalink(); ?>"
rel="author"><?php $this->author(); ?></a></li>
<li><?php _e('时间: '); ?>
<time datetime="<?php $this->date('c'); ?>" itemprop="datePublished"><?php $this->date(); ?></time>
</li>
<li><?php _e('分类: '); ?><?php $this->category(','); ?></li>
<li itemprop="interactionCount">
<a itemprop="discussionUrl"
href="<?php $this->permalink() ?>#comments"><?php $this->commentsNum('评论', '1 条评论', '%d 条评论'); ?></a>
</li>
</ul>
<?php postMeta($this); ?>
<div class="post-content" itemprop="articleBody">
<?php $this->content('- 阅读剩余部分 -'); ?>
<?php $this->content(_t('阅读剩余部分')); ?>
</div>
</article>
<?php endwhile; ?>
<?php else: ?>
<article class="post">
<h2 class="post-title"><?php _e('没有找到内容'); ?></h2>
</article>
<?php endif; ?>
<?php $this->pageNav('&laquo; 前一页', '后一页 &raquo;'); ?>
<?php $this->pageNav('&laquo; ' . _t('前一页'), _t('后一页') . ' &raquo;'); ?>
</div><!-- end #main-->
<?php $this->need('sidebar.php'); ?>

View File

@ -3,10 +3,7 @@
<div class="col-mb-12 col-8" id="main" role="main">
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<h1 class="post-title" itemprop="name headline">
<a itemprop="url"
href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
</h1>
<?php postMeta($this, 'page'); ?>
<div class="post-content" itemprop="articleBody">
<?php $this->content(); ?>
</div>

View File

@ -3,32 +3,18 @@
<div class="col-mb-12 col-8" id="main" role="main">
<article class="post" itemscope itemtype="http://schema.org/BlogPosting">
<h1 class="post-title" itemprop="name headline">
<a itemprop="url"
href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
</h1>
<ul class="post-meta">
<li itemprop="author" itemscope itemtype="http://schema.org/Person">
<?php _e('作者: '); ?><a itemprop="name"
href="<?php $this->author->permalink(); ?>"
rel="author"><?php $this->author(); ?></a>
</li>
<li><?php _e('时间: '); ?>
<time datetime="<?php $this->date('c'); ?>" itemprop="datePublished"><?php $this->date(); ?></time>
</li>
<li><?php _e('分类: '); ?><?php $this->category(','); ?></li>
</ul>
<?php postMeta($this, 'post'); ?>
<div class="post-content" itemprop="articleBody">
<?php $this->content(); ?>
</div>
<p itemprop="keywords" class="tags"><?php _e('标签: '); ?><?php $this->tags(', ', true, 'none'); ?></p>
<p itemprop="keywords" class="tags"><?php _e('标签'); ?>: <?php $this->tags(', ', true, 'none'); ?></p>
</article>
<?php $this->need('comments.php'); ?>
<ul class="post-near">
<li>上一篇: <?php $this->thePrev('%s', '没有了'); ?></li>
<li>下一篇: <?php $this->theNext('%s', '没有了'); ?></li>
<li>上一篇: <?php $this->thePrev('%s', _t('没有了')); ?></li>
<li>下一篇: <?php $this->theNext('%s', _t('没有了')); ?></li>
</ul>
</div><!-- end #main-->