summaryrefslogtreecommitdiffstats
path: root/pagefile.php
blob: a24d2bbc62da50ed1f7268ab65a0a7d47effe3d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
 * 归档页面
 *
 * @package custom
 */
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('includes/head.php');
$_SESSION["isPageArchive"] = true; //归档页面标识
$this->need('includes/header.php');
?>
    <main class="main-container container" role="main">
	  <div class="post-body">
	    <div class="post-content page-content">
		  <?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0&limit=30')->to($tags); ?>
          <h2>文章标签</h2>
          <?php if($tags->have()): ?>
          <ul class="tags-list">
          <?php while ($tags->next()): ?>
            <li class="tags-item"><a href="<?php $tags->permalink(); ?>" rel="tag" class="no-line" title="有 <?php $tags->count(); ?> 篇文章在这个标签下"><?php $tags->name(); ?></a></li>
          <?php endwhile; ?>
          </ul>
      <?php endif; ?>
		  <br />
		  <h2>文章归档</h2>
		  <ul class="archives-list"><?php
      $archives = Contents::archives($this);
      $number = 0;
      foreach($archives as $year => $posts) {
       $detailsOpen = ($number === 0) ? ' open' : NULL;
       echo '<details'.$detailsOpen.'>';
       echo '<summary>'.$year.' 年<small class="archives-count">共 '.count($posts).' 篇文章</small></summary>';
        foreach($posts as $created => $post) {
         echo '<li><a href="'.$post['permalink'].'" class="no-line">
          <span class="archives-date">'.date('m-d', $created).'</span>
          '.$post['title'].'
        </a></li>';
        }
       echo '</details>';
       $number++;
      }?>
		  </ul>
		</div>
	  </div>
	</main>
<?php $this->need('includes/footer.php'); ?>