文章头图显示

This commit is contained in:
Skywt2003 2021-08-14 11:05:26 +08:00
parent 8af5a5bb3b
commit 33e379476c
2 changed files with 5 additions and 2 deletions

View File

@ -24,9 +24,9 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit;
<?php while($this->next()): ?> <?php while($this->next()): ?>
<article class="mt-5 mb-5" itemscope itemtype="http://schema.org/BlogPosting"> <article class="mt-5 mb-5" itemscope itemtype="http://schema.org/BlogPosting">
<?php if ($this->fields->headPic !='') { ?> <?php if ($this->fields->headPic !=''): ?>
<img src=<?php $this->fields->headPic(); ?> class="img-fluid mx-auto d-block shadow rounded mb-3" alt="<?php $this->title(); ?>"> <img src=<?php $this->fields->headPic(); ?> class="img-fluid mx-auto d-block shadow rounded mb-3" alt="<?php $this->title(); ?>">
<?php } ?> <?php endif; ?>
<div> <div>
<h1 class="font-weight-bold post-title" itemprop="name headline"> <h1 class="font-weight-bold post-title" itemprop="name headline">
<a itemprop="url" href="<?php $this->permalink() ?>"><?php $this->title() ?></a> <a itemprop="url" href="<?php $this->permalink() ?>"><?php $this->title() ?></a>

View File

@ -3,6 +3,9 @@
<div class="col mt-5" id="main" role="main"> <div class="col mt-5" id="main" role="main">
<article itemscope itemtype="http://schema.org/BlogPosting"> <article itemscope itemtype="http://schema.org/BlogPosting">
<?php if ($this->fields->headPic !=''): ?>
<img src=<?php $this->fields->headPic(); ?> class="img-fluid mx-auto d-block shadow rounded mb-3" alt="<?php $this->title(); ?>">
<?php endif; ?>
<h1 class="font-weight-bold post-title" itemprop="name headline"><?php $this->title() ?></h1> <h1 class="font-weight-bold post-title" itemprop="name headline"><?php $this->title() ?></h1>
<div> <div>
<span class="text-gray"> <span class="text-gray">