第一次
This commit is contained in:
commit
73761afa20
|
@ -0,0 +1,16 @@
|
|||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('head.php'); ?>
|
||||
<body class="article-page">
|
||||
<?php $this->need('header.php'); ?>
|
||||
<main class="main full-width">
|
||||
<article class="has-image main-article">
|
||||
|
||||
<div class="article-details">
|
||||
|
||||
<?php _e('你想查看的页面已被转移或删除了, 要不要搜索看看: '); ?>
|
||||
|
||||
<div>
|
||||
</article>
|
||||
|
||||
|
||||
<?php $this->need('footer.php'); ?>
|
|
@ -0,0 +1,8 @@
|
|||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('head.php'); ?>
|
||||
<body class="article-page">
|
||||
<?php $this->need('header.php'); ?>
|
||||
|
||||
<?php $this->need('postlist.php'); ?>
|
||||
|
||||
<?php $this->need('footer.php'); ?>
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
/**
|
||||
* 文章归档
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('head.php'); ?>
|
||||
<body class="template-archives">
|
||||
<?php $this->need('header.php'); ?>
|
||||
<main class="main full-width">
|
||||
<header>
|
||||
<h2 class="section-title">Categories</h2>
|
||||
<div class="subsection-list">
|
||||
<div class="article-list--tile">
|
||||
<?php $this->widget('Widget_Metas_Category_List')->to($categories); ?>
|
||||
<?php while($categories->next()): ?>
|
||||
<?php
|
||||
// 获取分类 ID
|
||||
$categoryId = $categories->mid;
|
||||
// 获取主题URL
|
||||
$imgUrl = $this->options->imgurl;
|
||||
// 为每个分类生成图片地址
|
||||
$categoryImage = $imgUrl . '/' . $categoryId . '.jpg';
|
||||
?>
|
||||
<article class="has-image">
|
||||
<a href="<?php $categories->permalink(); ?>">
|
||||
<div class="article-image">
|
||||
<img src="<?php echo $categoryImage; ?>" loading="lazy" alt="<?php $categories->name(); ?>">
|
||||
</div>
|
||||
<div class="article-details">
|
||||
<h2 class="article-title"><?php $categories->name(); ?></h2>
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
<?php endwhile; ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<?php
|
||||
$stat = Typecho_Widget::widget('Widget_Stat');
|
||||
Typecho_Widget::widget('Widget_Contents_Post_Recent', 'pageSize=' . $stat->publishedPostsNum)->to($archives);
|
||||
$year = 0;
|
||||
$output = ' '; // Start archives container
|
||||
while ($archives->next()) {
|
||||
$year_tmp = date('Y', $archives->created);
|
||||
if ($year != $year_tmp) {
|
||||
if ($year > 0) {
|
||||
$output .= '</div>'; // 结束上一个年份的月份列表和包裹的div
|
||||
}
|
||||
$year = $year_tmp;
|
||||
$output .= '<div class="archives-group">
|
||||
<h2 class="archives-date section-title">' . $year . '</h2>'; // 开始新的年份div
|
||||
}
|
||||
// 输出文章项
|
||||
$output .= ' <div class="article-list--compact">';
|
||||
$output .= '<article>
|
||||
<a href="' . $archives->permalink . '">
|
||||
<div class="article-details">
|
||||
<h2 class="article-title">'. $archives->title . '</h2>
|
||||
<footer class="article-time">
|
||||
<time>'. date('m月d日', $archives->created) . '</time>
|
||||
</footer>
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
';
|
||||
$output .= '</div>';
|
||||
}
|
||||
$output .= ' '; // End archives container
|
||||
echo $output;
|
||||
?>
|
||||
</div>
|
||||
|
||||
<?php $this->need('footer.php'); ?>
|
|
@ -0,0 +1,17 @@
|
|||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<footer class="site-footer">
|
||||
<section class="copyright">
|
||||
©
|
||||
2020 - 2024 · <?php $this->options->title(); ?>
|
||||
</section>
|
||||
<section class="powerby">
|
||||
Powered by <a href="https://typecho.org/" target="_blank" rel="noopener">Typecho</a> <br />
|
||||
Theme <b><a href="https://github.com/CaiJimmy/hugo-theme-stack" target="_blank" rel="noopener" data-version="3.26.0">Stack</a></b> designed by <a href="https://jimmycai.com" target="_blank" rel="noopener">Jimmy</a>
|
||||
</section>
|
||||
<?php $this->options->tongji() ?>
|
||||
</footer>
|
||||
</main>
|
||||
</div>
|
||||
<script type="text/javascript" src="<?php $this->options->themeUrl('js/main.js'); ?>" defer></script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
function themeConfig($form) {
|
||||
$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, NULL, _t('站点 LOGO 地址'));
|
||||
$form->addInput($logoUrl);
|
||||
$icoUrl = new Typecho_Widget_Helper_Form_Element_Text('icoUrl', NULL, NULL, _t('站点 Favicon 地址'));
|
||||
$form->addInput($icoUrl);
|
||||
$archiveurl = new Typecho_Widget_Helper_Form_Element_Text('archiveurl', NULL, NULL, _t('归档页面地址'), _t('归档页面地址'));
|
||||
$form->addInput($archiveurl);
|
||||
$linksurl = new Typecho_Widget_Helper_Form_Element_Text('linksurl', NULL, NULL, _t('链接页面地址'), _t('链接页面地址'));
|
||||
$form->addInput($linksurl);
|
||||
$abouturl = new Typecho_Widget_Helper_Form_Element_Text('abouturl', NULL, NULL, _t('关于页面地址'), _t('关于页面地址'));
|
||||
$form->addInput($abouturl);
|
||||
$addmenu = new Typecho_Widget_Helper_Form_Element_Textarea('addmenu', NULL, NULL, _t('自定义菜单'), _t('具体查看使用文档'));
|
||||
$form->addInput($addmenu);
|
||||
$showgd = new Typecho_Widget_Helper_Form_Element_Radio('showgd',
|
||||
array('0'=> _t('否'), '1'=> _t('是')),
|
||||
'0', _t('是否在侧边栏显示按日期归档'), _t('选择“是”将展示。'));
|
||||
$form->addInput($showgd);
|
||||
$instagramurl = new Typecho_Widget_Helper_Form_Element_Text('instagramurl', NULL, NULL, _t('Instagram'), _t('会在个人信息显示'));
|
||||
$form->addInput($instagramurl);
|
||||
$telegramurl = new Typecho_Widget_Helper_Form_Element_Text('telegramurl', NULL, NULL, _t('电报'), _t('会在个人信息显示'));
|
||||
$form->addInput($telegramurl);
|
||||
$githuburl = new Typecho_Widget_Helper_Form_Element_Text('githuburl', NULL, NULL, _t('github'), _t('会在个人信息显示'));
|
||||
$form->addInput($githuburl);
|
||||
$twitterurl = new Typecho_Widget_Helper_Form_Element_Text('twitterurl', NULL, NULL, _t('twitter'), _t('会在个人信息显示'));
|
||||
$form->addInput($twitterurl);
|
||||
$mastodonurl = new Typecho_Widget_Helper_Form_Element_Text('mastodonurl', NULL, NULL, _t('mastodon'), _t('会在个人信息显示'));
|
||||
$form->addInput($mastodonurl);
|
||||
$sitemapurl = new Typecho_Widget_Helper_Form_Element_Text('sitemapurl', NULL, NULL, _t('sitemap'), _t('会在页脚显示'));
|
||||
$form->addInput($sitemapurl);
|
||||
$cnavatar = new Typecho_Widget_Helper_Form_Element_Text('cnavatar', NULL, 'https://cravatar.cn/avatar/', _t('Gravatar镜像'), _t('默认https://cravatar.cn/avatar/,建议保持默认'));
|
||||
$form->addInput($cnavatar);
|
||||
$imgurl = new Typecho_Widget_Helper_Form_Element_Text('imgurl', NULL, NULL, _t('分类图片目录'), _t('在目录下放入对应分类mid的jpg图片'));
|
||||
$form->addInput($imgurl);
|
||||
$twikoo = new Typecho_Widget_Helper_Form_Element_Textarea('twikoo', NULL, NULL, _t('使用第三方评论'), _t('不填写则不显示'));
|
||||
$form->addInput($twikoo);
|
||||
$addhead = new Typecho_Widget_Helper_Form_Element_Textarea('addhead', NULL, NULL, _t('Header代码'), _t('在head中插入代码,支持HTML'));
|
||||
$form->addInput($addhead);
|
||||
$tongji = new Typecho_Widget_Helper_Form_Element_Textarea('tongji', NULL, NULL, _t('Footer代码'), _t('在footer中插入代码支持HTML'));
|
||||
$form->addInput($tongji);
|
||||
}
|
||||
// 获取Typecho的选项
|
||||
$options = Typecho_Widget::widget('Widget_Options');
|
||||
// 检查cnavatar是否已设置,如果未设置或为空,则使用默认的Gravatar前缀
|
||||
$gravatarPrefix = empty($options->cnavatar) ? 'https://cravatar.cn/avatar/' : $options->cnavatar;
|
||||
// 定义全局常量__TYPECHO_GRAVATAR_PREFIX__,用于存储Gravatar前缀
|
||||
define('__TYPECHO_GRAVATAR_PREFIX__', $gravatarPrefix);
|
||||
//获取头图
|
||||
function img_postthumb($cid) {
|
||||
$db = Typecho_Db::get();
|
||||
$rs = $db->fetchRow($db->select('table.contents.text')
|
||||
->from('table.contents')
|
||||
->where('table.contents.cid=?', $cid)
|
||||
->order('table.contents.cid', Typecho_Db::SORT_ASC)
|
||||
->limit(1));
|
||||
// 检查是否获取到结果
|
||||
if (!$rs) {
|
||||
return "";
|
||||
}
|
||||
preg_match_all("/https?:\/\/[^\s]*.(png|jpeg|jpg|gif|bmp|webp)/", $rs['text'], $thumbUrl); //通过正则式获取图片地址
|
||||
// 检查是否匹配到图片URL
|
||||
if (count($thumbUrl[0]) > 0) {
|
||||
return $thumbUrl[0][0]; // 返回第一张图片的URL
|
||||
} else {
|
||||
return ""; // 没有匹配到图片URL,返回空字符串
|
||||
}
|
||||
}
|
||||
//文章目录功能-给文章内标题加上id
|
||||
function addHeaderLinks($text)
|
||||
{
|
||||
return preg_replace_callback('/<h([1-6])>(.*?)<\/h\1>/', function ($matches) {
|
||||
$level = $matches[1];
|
||||
$title = $matches[2];
|
||||
$id = htmlspecialchars(strip_tags($title), ENT_QUOTES, 'UTF-8');
|
||||
return sprintf('<h%s id="%s"><a href="#%s" title="%s">%s</a></h%s>', $level, $id, $id, $title, $title, $level);
|
||||
}, $text);
|
||||
}
|
||||
//文章最后修改时间
|
||||
function get_last_modified_time($postId) {
|
||||
// 获取数据库对象
|
||||
$db = Typecho_Db::get();
|
||||
$prefix = $db->getPrefix();
|
||||
|
||||
// 查询文章的最后修改时间
|
||||
$query = $db->select('modified')
|
||||
->from($prefix . 'contents')
|
||||
->where('cid = ?', $postId)
|
||||
->limit(1);
|
||||
|
||||
// 执行查询
|
||||
$row = $db->fetchRow($query);
|
||||
|
||||
// 检查是否有结果
|
||||
if ($row) {
|
||||
// 返回格式化后的时间
|
||||
return date('Y-m-d H:i:s', $row['modified']);
|
||||
} else {
|
||||
// 如果没有结果,返回空字符串
|
||||
return '';
|
||||
}
|
||||
}
|
||||
//阅读时间
|
||||
function getReadingTime($text, $wordsPerMinute = 500) {
|
||||
// 移除HTML标签
|
||||
$text = strip_tags($text);
|
||||
// 移除多余的空格
|
||||
$text = trim($text);
|
||||
// 计算字数
|
||||
$wordCount = mb_strlen($text, 'UTF-8');
|
||||
// 计算阅读时间
|
||||
$readingTime = ceil($wordCount / $wordsPerMinute);
|
||||
return $readingTime;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta name="generator" content="Hugo 0.123.8">
|
||||
<meta charset='utf-8'>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1'>
|
||||
<meta name='description' content="<?php $this->options->description() ?>.">
|
||||
<title><?php $this->archiveTitle([
|
||||
'category' => _t('分类 %s 下的文章'),
|
||||
'search' => _t('包含关键字 %s 的文章'),
|
||||
'tag' => _t('标签 %s 下的文章'),
|
||||
'author' => _t('%s 发布的文章')
|
||||
], '', ' - '); ?><?php $this->options->title(); ?></title>
|
||||
<link rel='canonical' href='<?php $this->options->siteUrl(); ?>'>
|
||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('style.css'); ?>">
|
||||
<meta property='og:title' content="<?php $this->options->siteUrl(); ?>">
|
||||
<meta property='og:description' content="<?php $this->options->description() ?>.">
|
||||
<meta property='og:url' content='<?php $this->options->siteUrl(); ?>'>
|
||||
<meta property='og:site_name' content='<?php $this->options->title(); ?>'>
|
||||
<meta property='og:type' content='website'>
|
||||
<meta name="twitter:title" content="<?php $this->options->siteUrl(); ?>">
|
||||
<meta name="twitter:description" content="<?php $this->options->description() ?>.">
|
||||
<link rel="alternate" type="application/rss+xml" href="<?php $this->options->siteUrl(); ?>feed">
|
||||
<link rel="shortcut icon" href="<?php $this->options->iconUrl(); ?>" />
|
||||
<?php $this->options->addhead() ?>
|
||||
<?php $this->header("generator=&template="); ?>
|
||||
</head>
|
||||
<script>
|
||||
(function() {
|
||||
const colorSchemeKey = 'StackColorScheme';
|
||||
if(!localStorage.getItem(colorSchemeKey)){
|
||||
localStorage.setItem(colorSchemeKey, "auto");
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
<script>
|
||||
(function() {
|
||||
const colorSchemeKey = 'StackColorScheme';
|
||||
const colorSchemeItem = localStorage.getItem(colorSchemeKey);
|
||||
const supportDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches === true;
|
||||
|
||||
if (colorSchemeItem == 'dark' || colorSchemeItem === 'auto' && supportDarkMode) {
|
||||
|
||||
|
||||
document.documentElement.dataset.scheme = 'dark';
|
||||
} else {
|
||||
document.documentElement.dataset.scheme = 'light';
|
||||
}
|
||||
})();
|
||||
</script>
|
|
@ -0,0 +1,93 @@
|
|||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<div class="container main-container flex on-phone--column extended">
|
||||
<aside class="sidebar left-sidebar sticky ">
|
||||
<button class="hamburger hamburger--spin" type="button" id="toggle-menu" aria-label="Toggle Menu">
|
||||
<span class="hamburger-box">
|
||||
<span class="hamburger-inner"></span>
|
||||
</span>
|
||||
</button>
|
||||
<header>
|
||||
<figure class="site-avatar">
|
||||
<a href="<?php $this->options->siteUrl(); ?>">
|
||||
<img src="<?php $this->options->logoUrl(); ?>" width="300"
|
||||
height="300" class="site-logo" loading="lazy" alt="Avatar">
|
||||
</a>
|
||||
<span class="emoji">🍥</span>
|
||||
</figure>
|
||||
<div class="site-meta">
|
||||
<h1 class="site-name"><a href="/"><?php $this->options->title(); ?></a></h1>
|
||||
<h2 class="site-description"><?php $this->options->description() ?></h2>
|
||||
</div>
|
||||
</header>
|
||||
<ol class="menu-social">
|
||||
<?php if($this->options->telegramurl): ?>
|
||||
<li><a href="<?php $this->options->telegramurl() ?>" target="_blank">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-twitter" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M17.0943 7.14643C17.6874 6.93123 17.9818 6.85378 18.1449 6.82608C18.1461 6.87823 18.1449 6.92051 18.1422 6.94825C17.9096 9.39217 16.8906 15.4048 16.3672 18.2026C16.2447 18.8578 16.1507 19.1697 15.5179 18.798C15.1014 18.5532 14.7245 18.2452 14.3207 17.9805C12.9961 17.1121 11.1 15.8189 11.2557 15.8967C9.95162 15.0373 10.4975 14.5111 11.2255 13.8093C11.3434 13.6957 11.466 13.5775 11.5863 13.4525C11.64 13.3967 11.9027 13.1524 12.2731 12.8081C13.4612 11.7035 15.7571 9.56903 15.8151 9.32202C15.8246 9.2815 15.8334 9.13045 15.7436 9.05068C15.6539 8.97092 15.5215 8.9982 15.4259 9.01989C15.2904 9.05064 13.1326 10.4769 8.95243 13.2986C8.33994 13.7192 7.78517 13.9242 7.28811 13.9134L7.29256 13.9156C6.63781 13.6847 5.9849 13.4859 5.32855 13.286C4.89736 13.1546 4.46469 13.0228 4.02904 12.8812C3.92249 12.8466 3.81853 12.8137 3.72083 12.783C8.24781 10.8109 11.263 9.51243 12.7739 8.884C14.9684 7.97124 16.2701 7.44551 17.0943 7.14643ZM19.5169 5.21806C19.2635 5.01244 18.985 4.91807 18.7915 4.87185C18.5917 4.82412 18.4018 4.80876 18.2578 4.8113C17.7814 4.81969 17.2697 4.95518 16.4121 5.26637C15.5373 5.58382 14.193 6.12763 12.0058 7.03736C10.4638 7.67874 7.39388 9.00115 2.80365 11.001C2.40046 11.1622 2.03086 11.3451 1.73884 11.5619C1.46919 11.7622 1.09173 12.1205 1.02268 12.6714C0.970519 13.0874 1.09182 13.4714 1.33782 13.7738C1.55198 14.037 1.82635 14.1969 2.03529 14.2981C2.34545 14.4483 2.76276 14.5791 3.12952 14.6941C3.70264 14.8737 4.27444 15.0572 4.84879 15.233C6.62691 15.7773 8.09066 16.2253 9.7012 17.2866C10.8825 18.0651 12.041 18.8775 13.2243 19.6531C13.6559 19.936 14.0593 20.2607 14.5049 20.5224C14.9916 20.8084 15.6104 21.0692 16.3636 20.9998C17.5019 20.8951 18.0941 19.8479 18.3331 18.5703C18.8552 15.7796 19.8909 9.68351 20.1332 7.13774C20.1648 6.80544 20.1278 6.433 20.097 6.25318C20.0653 6.068 19.9684 5.58448 19.5169 5.21806Z"></path></svg>
|
||||
</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($this->options->twitterurl): ?>
|
||||
<li><a href="<?php $this->options->twitterurl() ?>" target="_blank">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-twitter" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M8 2H1L9.26086 13.0145L1.44995 21.9999H4.09998L10.4883 14.651L16 22H23L14.3917 10.5223L21.8001 2H19.1501L13.1643 8.88578L8 2ZM17 20L5 4H7L19 20H17Z"></path></svg>
|
||||
</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($this->options->instagramurl): ?>
|
||||
<li><a href="<?php $this->options->instagramurl() ?>" target="_blank">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-twitter" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M12.001 9C10.3436 9 9.00098 10.3431 9.00098 12C9.00098 13.6573 10.3441 15 12.001 15C13.6583 15 15.001 13.6569 15.001 12C15.001 10.3427 13.6579 9 12.001 9ZM12.001 7C14.7614 7 17.001 9.2371 17.001 12C17.001 14.7605 14.7639 17 12.001 17C9.24051 17 7.00098 14.7629 7.00098 12C7.00098 9.23953 9.23808 7 12.001 7ZM18.501 6.74915C18.501 7.43926 17.9402 7.99917 17.251 7.99917C16.5609 7.99917 16.001 7.4384 16.001 6.74915C16.001 6.0599 16.5617 5.5 17.251 5.5C17.9393 5.49913 18.501 6.0599 18.501 6.74915ZM12.001 4C9.5265 4 9.12318 4.00655 7.97227 4.0578C7.18815 4.09461 6.66253 4.20007 6.17416 4.38967C5.74016 4.55799 5.42709 4.75898 5.09352 5.09255C4.75867 5.4274 4.55804 5.73963 4.3904 6.17383C4.20036 6.66332 4.09493 7.18811 4.05878 7.97115C4.00703 9.0752 4.00098 9.46105 4.00098 12C4.00098 14.4745 4.00753 14.8778 4.05877 16.0286C4.0956 16.8124 4.2012 17.3388 4.39034 17.826C4.5591 18.2606 4.7605 18.5744 5.09246 18.9064C5.42863 19.2421 5.74179 19.4434 6.17187 19.6094C6.66619 19.8005 7.19148 19.9061 7.97212 19.9422C9.07618 19.9939 9.46203 20 12.001 20C14.4755 20 14.8788 19.9934 16.0296 19.9422C16.8117 19.9055 17.3385 19.7996 17.827 19.6106C18.2604 19.4423 18.5752 19.2402 18.9074 18.9085C19.2436 18.5718 19.4445 18.2594 19.6107 17.8283C19.8013 17.3358 19.9071 16.8098 19.9432 16.0289C19.9949 14.9248 20.001 14.5389 20.001 12C20.001 9.52552 19.9944 9.12221 19.9432 7.97137C19.9064 7.18906 19.8005 6.66149 19.6113 6.17318C19.4434 5.74038 19.2417 5.42635 18.9084 5.09255C18.573 4.75715 18.2616 4.55693 17.8271 4.38942C17.338 4.19954 16.8124 4.09396 16.0298 4.05781C14.9258 4.00605 14.5399 4 12.001 4ZM12.001 2C14.7176 2 15.0568 2.01 16.1235 2.06C17.1876 2.10917 17.9135 2.2775 18.551 2.525C19.2101 2.77917 19.7668 3.1225 20.3226 3.67833C20.8776 4.23417 21.221 4.7925 21.476 5.45C21.7226 6.08667 21.891 6.81333 21.941 7.8775C21.9885 8.94417 22.001 9.28333 22.001 12C22.001 14.7167 21.991 15.0558 21.941 16.1225C21.8918 17.1867 21.7226 17.9125 21.476 18.55C21.2218 19.2092 20.8776 19.7658 20.3226 20.3217C19.7668 20.8767 19.2076 21.22 18.551 21.475C17.9135 21.7217 17.1876 21.89 16.1235 21.94C15.0568 21.9875 14.7176 22 12.001 22C9.28431 22 8.94514 21.99 7.87848 21.94C6.81431 21.8908 6.08931 21.7217 5.45098 21.475C4.79264 21.2208 4.23514 20.8767 3.67931 20.3217C3.12348 19.7658 2.78098 19.2067 2.52598 18.55C2.27848 17.9125 2.11098 17.1867 2.06098 16.1225C2.01348 15.0558 2.00098 14.7167 2.00098 12C2.00098 9.28333 2.01098 8.94417 2.06098 7.8775C2.11014 6.8125 2.27848 6.0875 2.52598 5.45C2.78014 4.79167 3.12348 4.23417 3.67931 3.67833C4.23514 3.1225 4.79348 2.78 5.45098 2.525C6.08848 2.2775 6.81348 2.11 7.87848 2.06C8.94514 2.0125 9.28431 2 12.001 2Z"></path></svg>
|
||||
</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($this->options->githuburl): ?>
|
||||
<li><a href="<?php $this->options->githuburl() ?>" target="_blank">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-twitter" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M5.88401 18.6533C5.58404 18.4526 5.32587 18.1975 5.0239 17.8369C4.91473 17.7065 4.47283 17.1524 4.55811 17.2583C4.09533 16.6833 3.80296 16.417 3.50156 16.3089C2.9817 16.1225 2.7114 15.5499 2.89784 15.0301C3.08428 14.5102 3.65685 14.2399 4.17672 14.4263C4.92936 14.6963 5.43847 15.1611 6.12425 16.0143C6.03025 15.8974 6.46364 16.441 6.55731 16.5529C6.74784 16.7804 6.88732 16.9182 6.99629 16.9911C7.20118 17.1283 7.58451 17.1874 8.14709 17.1311C8.17065 16.7489 8.24136 16.3783 8.34919 16.0358C5.38097 15.3104 3.70116 13.3952 3.70116 9.63971C3.70116 8.40085 4.0704 7.28393 4.75917 6.3478C4.5415 5.45392 4.57433 4.37284 5.06092 3.15636C5.1725 2.87739 5.40361 2.66338 5.69031 2.57352C5.77242 2.54973 5.81791 2.53915 5.89878 2.52673C6.70167 2.40343 7.83573 2.69705 9.31449 3.62336C10.181 3.41879 11.0885 3.315 12.0012 3.315C12.9129 3.315 13.8196 3.4186 14.6854 3.62277C16.1619 2.69 17.2986 2.39649 18.1072 2.52651C18.1919 2.54013 18.2645 2.55783 18.3249 2.57766C18.6059 2.66991 18.8316 2.88179 18.9414 3.15636C19.4279 4.37256 19.4608 5.45344 19.2433 6.3472C19.9342 7.28337 20.3012 8.39208 20.3012 9.63971C20.3012 13.3968 18.627 15.3048 15.6588 16.032C15.7837 16.447 15.8496 16.9105 15.8496 17.4121C15.8496 18.0765 15.8471 18.711 15.8424 19.4225C15.8412 19.6127 15.8397 19.8159 15.8375 20.1281C16.2129 20.2109 16.5229 20.5077 16.6031 20.9089C16.7114 21.4504 16.3602 21.9773 15.8186 22.0856C14.6794 22.3134 13.8353 21.5538 13.8353 20.5611C13.8353 20.4708 13.836 20.3417 13.8375 20.1145C13.8398 19.8015 13.8412 19.599 13.8425 19.4094C13.8471 18.7019 13.8496 18.0716 13.8496 17.4121C13.8496 16.7148 13.6664 16.2602 13.4237 16.051C12.7627 15.4812 13.0977 14.3973 13.965 14.2999C16.9314 13.9666 18.3012 12.8177 18.3012 9.63971C18.3012 8.68508 17.9893 7.89571 17.3881 7.23559C17.1301 6.95233 17.0567 6.54659 17.199 6.19087C17.3647 5.77663 17.4354 5.23384 17.2941 4.57702L17.2847 4.57968C16.7928 4.71886 16.1744 5.0198 15.4261 5.5285C15.182 5.69438 14.8772 5.74401 14.5932 5.66413C13.7729 5.43343 12.8913 5.315 12.0012 5.315C11.111 5.315 10.2294 5.43343 9.40916 5.66413C9.12662 5.74359 8.82344 5.69492 8.57997 5.53101C7.8274 5.02439 7.2056 4.72379 6.71079 4.58376C6.56735 5.23696 6.63814 5.77782 6.80336 6.19087C6.94565 6.54659 6.87219 6.95233 6.61423 7.23559C6.01715 7.8912 5.70116 8.69376 5.70116 9.63971C5.70116 12.8116 7.07225 13.9683 10.023 14.2999C10.8883 14.3971 11.2246 15.4769 10.5675 16.0482C10.3751 16.2156 10.1384 16.7802 10.1384 17.4121V20.5611C10.1384 21.5474 9.30356 22.2869 8.17878 22.09C7.63476 21.9948 7.27093 21.4766 7.36613 20.9326C7.43827 20.5204 7.75331 20.2116 8.13841 20.1276V19.1381C7.22829 19.1994 6.47656 19.0498 5.88401 18.6533Z"></path></svg>
|
||||
</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($this->options->mastodonurl): ?>
|
||||
<li><a href="<?php $this->options->mastodonurl() ?>" target="_blank">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-brand-twitter" viewBox="0 0 24 24" width="32" height="32" fill="currentColor"><path d="M3.019 12.0075C2.98744 10.7478 3.00692 9.5598 3.00692 8.56644C3.00692 4.22767 5.84954 2.95597 5.84954 2.95597C7.28286 2.29767 9.74238 2.0209 12.2993 2H12.3621C14.919 2.0209 17.3801 2.29767 18.8134 2.95597C18.8134 2.95597 21.656 4.22767 21.656 8.56644C21.656 8.56644 21.6916 11.7674 21.2596 13.9898C20.9852 15.4007 18.8034 16.9446 16.2974 17.2438C14.9906 17.3999 13.7042 17.5431 12.3322 17.4802C10.0885 17.3775 8.31815 16.9446 8.31815 16.9446C8.31815 17.1631 8.33166 17.3711 8.35853 17.5655C8.44182 18.1978 8.65659 18.6604 8.96296 19C9.72944 19.8497 11.0692 19.9301 12.3577 19.9743C14.178 20.0366 15.7986 19.5254 15.7986 19.5254L15.8735 21.1712C15.8735 21.1712 14.6003 21.8548 12.3322 21.9805C11.0815 22.0493 9.52858 21.9491 7.71969 21.4704C6.18802 21.065 5.15153 20.1804 4.45091 19C3.35714 17.1573 3.08191 14.5938 3.019 12.0075ZM6.31815 16.9446V14.3967L8.79316 15.0018C8.8405 15.0134 8.95098 15.0383 9.11692 15.0723C9.40521 15.1313 9.73416 15.1908 10.0959 15.2467C10.8485 15.3628 11.6341 15.4462 12.4237 15.4823C13.4425 15.529 14.3249 15.4652 16.0603 15.2579C17.7233 15.0594 19.208 14.0622 19.2963 13.6082C19.3783 13.1861 19.4472 12.6858 19.5021 12.1261C19.5714 11.4205 19.6155 10.6558 19.6388 9.88068C19.654 9.37026 19.6582 8.93648 19.6564 8.62452L19.656 8.56644C19.656 7.1368 19.2873 6.12756 18.6928 5.40793C18.5008 5.17553 18.3004 4.99408 18.1087 4.85958C18.0183 4.79617 17.9737 4.77136 17.9787 4.77345C16.9662 4.30844 14.8859 4.02069 12.3621 3.99993H12.3156C9.77596 4.02069 7.6969 4.30836 6.66627 4.78161C6.68919 4.77136 6.64459 4.79617 6.55423 4.85958C6.36257 4.99408 6.16214 5.17553 5.97016 5.40793C5.37568 6.12756 5.00692 7.1368 5.00692 8.56644C5.00692 8.7976 5.00628 8.96339 5.00392 9.44137C4.9981 10.6238 5.00004 11.2256 5.01841 11.9589C5.07185 14.156 5.2822 15.7941 5.71797 17C5.93023 17.5874 6.19005 18.0709 6.49741 18.4507C6.37791 18.0162 6.31815 17.5142 6.31815 16.9446ZM8.08576 6.37135C8.71735 6.37135 9.22924 6.88324 9.22924 7.51482C9.22924 8.14626 8.71735 8.6583 8.08576 8.6583C7.45432 8.6583 6.94229 8.14626 6.94229 7.51482C6.94229 6.88324 7.45432 6.37135 8.08576 6.37135Z"></path></svg>
|
||||
</a></li>
|
||||
<?php endif; ?>
|
||||
</ol>
|
||||
<ol class="menu" id="main-menu">
|
||||
<li >
|
||||
<a href='/' >
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-home" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z"/><polyline points="5 12 3 12 12 3 21 12 19 12" /><path d="M5 12v7a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-7" /><path d="M9 21v-6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v6" /></svg>
|
||||
<span>首页</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php if($this->options->archiveurl): ?>
|
||||
<li ><a href="<?php $this->options->archiveurl() ?>">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-archive" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z"/><rect x="3" y="4" width="18" height="4" rx="2" /><path d="M5 8v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-10" /><line x1="10" y1="12" x2="14" y2="12" /></svg>
|
||||
<span>归档</span></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($this->options->linksurl): ?>
|
||||
<li ><a href="<?php $this->options->linksurl() ?>">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z"/><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" /><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" /></svg>
|
||||
<span>链接</span></a></li>
|
||||
<?php endif; ?>
|
||||
<?php if($this->options->abouturl): ?>
|
||||
<li ><a href="<?php $this->options->abouturl() ?>">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-user" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="12" cy="7" r="4" />
|
||||
<path d="M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2" />
|
||||
</svg> <span>关于</span></a></li>
|
||||
<?php endif; ?>
|
||||
<?php $this->options->addmenu() ?>
|
||||
<li class="menu-bottom-section">
|
||||
<ol class="menu">
|
||||
<li id="dark-mode-toggle">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-toggle-left" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="8" cy="12" r="2" />
|
||||
<rect x="2" y="6" width="20" height="12" rx="6" />
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-toggle-right" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="16" cy="12" r="2" />
|
||||
<rect x="2" y="6" width="20" height="12" rx="6" />
|
||||
</svg>
|
||||
<span>模式</span>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
</aside>
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
/**
|
||||
* stack theme for Typecho
|
||||
*
|
||||
* @package Typecho stack Theme
|
||||
* @author Sun
|
||||
* @version 0.1
|
||||
* @link http://imsun.org
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
|
||||
?>
|
||||
<?php $this->need('head.php'); ?>
|
||||
<body class="">
|
||||
<?php $this->need('header.php'); ?>
|
||||
<?php $this->need('sidebar.php'); ?>
|
||||
<?php $this->need('postlist.php'); ?>
|
||||
|
||||
<?php $this->need('footer.php'); ?>
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
/**
|
||||
* 友情链接
|
||||
*
|
||||
* @package custom
|
||||
*/
|
||||
if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('head.php'); ?>
|
||||
<body class="template-archives">
|
||||
<?php $this->need('header.php'); ?>
|
||||
<main class="main full-width">
|
||||
<article class="main-article">
|
||||
<header class="article-header">
|
||||
<div class="article-details">
|
||||
<div class="article-title-wrapper">
|
||||
<h2 class="article-title">
|
||||
<?php $this->title() ?>
|
||||
</h2>
|
||||
<h3 class="article-subtitle">
|
||||
<?php $this->content(); ?>
|
||||
</h3>
|
||||
</div>
|
||||
<section class="article-content">
|
||||
</section>
|
||||
</article>
|
||||
<div class="article-list--compact links">
|
||||
<?php
|
||||
Links_Plugin::output('<article>
|
||||
<a href="{url}" target="_blank" rel="noopener">
|
||||
<div class="article-details">
|
||||
<h2 class="article-title">{name}</h2>
|
||||
<footer class="article-time">
|
||||
{title}
|
||||
</footer>
|
||||
</div>
|
||||
<div class="article-image">
|
||||
<img src="{image}" loading="lazy">
|
||||
</div>
|
||||
</a>
|
||||
</article>
|
||||
');
|
||||
?>
|
||||
|
||||
</div>
|
||||
<?php $this->need('footer.php'); ?>
|
|
@ -0,0 +1,95 @@
|
|||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('head.php'); ?>
|
||||
<body class="article-page">
|
||||
<?php $this->need('header.php'); ?>
|
||||
<main class="main full-width">
|
||||
<article class="has-image main-article">
|
||||
<header class="article-header">
|
||||
<?php $firstImage = img_postthumb($this->cid); $cover = $this->fields->cover; $imageToDisplay = !empty($cover) ? $cover : $firstImage; if($imageToDisplay): ?>
|
||||
<div class="article-image">
|
||||
<a href="<?php $this->permalink() ?>">
|
||||
<img src="<?php echo $imageToDisplay; ?>" width="800" height="534" loading="lazy" alt="<?php $this->title() ?>" />
|
||||
</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<div class="article-details">
|
||||
<header class="article-category">
|
||||
<?php foreach($this->categories as $category): ?>
|
||||
<a href="<?php echo $category['permalink']; ?>" style="background-color: #2a9d8f; color: #fff;"><?php echo $category['name']; ?></a>
|
||||
<?php endforeach; ?>
|
||||
</header>
|
||||
<div class="article-title-wrapper">
|
||||
<h2 class="article-title">
|
||||
<a href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
|
||||
</h2>
|
||||
<h3 class="article-subtitle">
|
||||
|
||||
</h3>
|
||||
</div>
|
||||
<footer class="article-time">
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-calendar-time" width="56" height="56" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<path d="M11.795 21h-6.795a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4" />
|
||||
<circle cx="18" cy="18" r="4" />
|
||||
<path d="M15 3v4" />
|
||||
<path d="M7 3v4" />
|
||||
<path d="M3 11h16" />
|
||||
<path d="M18 16.496v1.504l1 1" />
|
||||
</svg>
|
||||
<time class="article-time--published"><?php $this->date(); ?></time>
|
||||
</div>
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<polyline points="12 7 12 12 15 15" />
|
||||
</svg>
|
||||
<time class="article-time--reading">
|
||||
<?php $content = $this->content; // 获取文章内容 ?><?php $readingTime = getReadingTime($content); // 计算阅读时间 ?><?php echo isset($readingTime) ? $readingTime . ' minutes' : '未知'; ?> read
|
||||
</time>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</header>
|
||||
<section class="article-content">
|
||||
<?php $content = $this->content; echo addHeaderLinks($content); ?>
|
||||
</section>
|
||||
<footer class="article-footer">
|
||||
|
||||
<section class="article-copyright">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-copyright" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<path d="M14.5 9a3.5 4 0 1 0 0 6" />
|
||||
</svg>
|
||||
<span>CC BY-NC-SA 4.0 Deed | 署名-非商业性使用-相同方式共享 </span>
|
||||
</section>
|
||||
<section class="article-lastmod">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<polyline points="12 7 12 12 15 15" />
|
||||
</svg>
|
||||
<span>
|
||||
<?php
|
||||
// 获取当前文章的 ID
|
||||
$postId = $this->cid;
|
||||
|
||||
// 获取最后更新时间
|
||||
$lastModifiedTime = get_last_modified_time($postId);
|
||||
|
||||
// 显示最后更新时间
|
||||
if ($lastModifiedTime) {
|
||||
echo ' 最后更新时间:' . htmlspecialchars($lastModifiedTime) . ' ';
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</section>
|
||||
</footer>
|
||||
</article>
|
||||
|
||||
|
||||
<?php $this->need('footer.php'); ?>
|
|
@ -0,0 +1,121 @@
|
|||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<?php $this->need('head.php'); ?>
|
||||
<body class="article-page">
|
||||
<?php $this->need('header.php'); ?>
|
||||
<?php
|
||||
// 引入 TOC.php 文件
|
||||
require_once 'toc.php';
|
||||
// 获取当前文章内容
|
||||
if ($this->is('post')) {
|
||||
$content = $this->content;
|
||||
echo generate_toc($content);
|
||||
}
|
||||
?>
|
||||
<main class="main full-width">
|
||||
<article class="has-image main-article">
|
||||
<header class="article-header">
|
||||
<?php $firstImage = img_postthumb($this->cid); $cover = $this->fields->cover; $imageToDisplay = !empty($cover) ? $cover : $firstImage; if($imageToDisplay): ?>
|
||||
<div class="article-image">
|
||||
<a href="<?php $this->permalink() ?>">
|
||||
<img src="<?php echo $imageToDisplay; ?>" width="800" height="534" loading="lazy" alt="<?php $this->title() ?>" />
|
||||
</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php endif; ?>
|
||||
<div class="article-details">
|
||||
<header class="article-category">
|
||||
<?php foreach($this->categories as $category): ?>
|
||||
<a href="<?php echo $category['permalink']; ?>" style="background-color: #2a9d8f; color: #fff;"><?php echo $category['name']; ?></a>
|
||||
<?php endforeach; ?>
|
||||
</header>
|
||||
<div class="article-title-wrapper">
|
||||
<h2 class="article-title">
|
||||
<a href="<?php $this->permalink() ?>"><?php $this->title() ?></a>
|
||||
</h2>
|
||||
<h3 class="article-subtitle">
|
||||
<!-- 删除摘要-->
|
||||
</h3>
|
||||
</div>
|
||||
<footer class="article-time">
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-calendar-time" width="56" height="56" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<path d="M11.795 21h-6.795a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4" />
|
||||
<circle cx="18" cy="18" r="4" />
|
||||
<path d="M15 3v4" />
|
||||
<path d="M7 3v4" />
|
||||
<path d="M3 11h16" />
|
||||
<path d="M18 16.496v1.504l1 1" />
|
||||
</svg>
|
||||
<time class="article-time--published"><?php $this->date(); ?></time>
|
||||
</div>
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<polyline points="12 7 12 12 15 15" />
|
||||
</svg>
|
||||
<time class="article-time--reading">
|
||||
<?php $content = $this->content; // 获取文章内容 ?><?php $readingTime = getReadingTime($content); // 计算阅读时间 ?><?php echo isset($readingTime) ? $readingTime . ' minutes' : '未知'; ?> read
|
||||
</time>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</header>
|
||||
<section class="article-content">
|
||||
<?php $content = $this->content; echo addHeaderLinks($content); ?>
|
||||
</section>
|
||||
<footer class="article-footer">
|
||||
<section class="article-tags">
|
||||
<?php $this->tags(' ', true, 'none'); ?>
|
||||
</section>
|
||||
<section class="article-copyright">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-copyright" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<path d="M14.5 9a3.5 4 0 1 0 0 6" />
|
||||
</svg>
|
||||
<span>CC BY-NC-SA 4.0 Deed | 署名-非商业性使用-相同方式共享 </span>
|
||||
</section>
|
||||
<section class="article-lastmod">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<polyline points="12 7 12 12 15 15" />
|
||||
</svg>
|
||||
<span>
|
||||
<?php
|
||||
// 获取当前文章的 ID
|
||||
$postId = $this->cid;
|
||||
|
||||
// 获取最后更新时间
|
||||
$lastModifiedTime = get_last_modified_time($postId);
|
||||
|
||||
// 显示最后更新时间
|
||||
if ($lastModifiedTime) {
|
||||
echo ' 最后更新时间:' . htmlspecialchars($lastModifiedTime) . ' ';
|
||||
}
|
||||
?>
|
||||
</span>
|
||||
</section>
|
||||
</footer>
|
||||
</article>
|
||||
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"integrity="sha256-ePwmChbbvXbsO02lbM3HoHbSHTHFAeChekF1xKJdleo="crossorigin="anonymous"
|
||||
defer
|
||||
>
|
||||
</script><script
|
||||
src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"integrity="sha256-UKkzOn/w1mBxRmLLGrSeyB4e1xbrp4xylgAWb3M42pU="crossorigin="anonymous"
|
||||
defer
|
||||
>
|
||||
</script><link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css"crossorigin="anonymous"
|
||||
><link
|
||||
rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css"crossorigin="anonymous"
|
||||
>
|
||||
<script src="https://cdn.jsdelivr.net/npm/node-vibrant@3.1.6/dist/vibrant.min.js"integrity="sha256-awcR2jno4kI5X0zL8ex0vi2z+KMkF24hUW8WePSA9HM="crossorigin="anonymous"></script>
|
||||
<div class="disqus-container">
|
||||
<?php $this->options->twikoo() ?>
|
||||
</div>
|
||||
<?php $this->need('footer.php'); ?>
|
|
@ -0,0 +1,126 @@
|
|||
|
||||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<main class="main full-width">
|
||||
<section class="article-list">
|
||||
<?php while ($this->next()): ?>
|
||||
<?php $firstImage = img_postthumb($this->cid); $cover = $this->fields->cover; $imageToDisplay = !empty($cover) ? $cover : $firstImage; if($imageToDisplay): ?>
|
||||
<article class="has-image">
|
||||
<header class="article-header">
|
||||
<div class="article-image">
|
||||
<a href="<?php $this->permalink() ?>">
|
||||
<img src="<?php echo $imageToDisplay; ?>" width="800" height="534" loading="lazy" alt="<?php $this->title() ?>" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="article-details">
|
||||
<header class="article-category">
|
||||
<?php foreach($this->categories as $category): ?>
|
||||
<a href="<?php echo $category['permalink']; ?>" style="background-color: #2a9d8f; color: #fff;"><?php echo $category['name']; ?></a>
|
||||
<?php endforeach; ?>
|
||||
</header>
|
||||
<div class="article-title-wrapper">
|
||||
<h2 class="article-title">
|
||||
<a href="<?php $this->permalink() ?>"><?php $this->sticky();$this->title() ?></a>
|
||||
</h2>
|
||||
<h3 class="article-subtitle">
|
||||
<?php // 判断是否存在自定义字段summary并输出,否则输出自动生成的摘要
|
||||
if($this->fields->summary){
|
||||
echo $this->fields->summary;
|
||||
} else {
|
||||
$this->excerpt(200);
|
||||
}?>
|
||||
</h3>
|
||||
</div>
|
||||
<footer class="article-time">
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-calendar-time" width="56" height="56" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<path d="M11.795 21h-6.795a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4" />
|
||||
<circle cx="18" cy="18" r="4" />
|
||||
<path d="M15 3v4" />
|
||||
<path d="M7 3v4" />
|
||||
<path d="M3 11h16" />
|
||||
<path d="M18 16.496v1.504l1 1" />
|
||||
</svg>
|
||||
<time class="article-time--published"><?php $this->date(); ?></time>
|
||||
</div>
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<polyline points="12 7 12 12 15 15" />
|
||||
</svg>
|
||||
<time class="article-time--reading">
|
||||
<?php $content = $this->content; // 获取文章内容 ?><?php $readingTime = getReadingTime($content); // 计算阅读时间 ?><?php echo isset($readingTime) ? $readingTime . ' minutes' : '未知'; ?> read
|
||||
|
||||
</time>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</header>
|
||||
</article>
|
||||
<?php else: ?>
|
||||
|
||||
<article class="">
|
||||
<header class="article-header">
|
||||
<div class="article-details">
|
||||
<header class="article-category">
|
||||
<?php foreach($this->categories as $category): ?>
|
||||
<a href="<?php echo $category['permalink']; ?>" style="background-color: #2a9d8f; color: #fff;"><?php echo $category['name']; ?></a>
|
||||
<?php endforeach; ?>
|
||||
</header>
|
||||
<div class="article-title-wrapper">
|
||||
<h2 class="article-title">
|
||||
<a href="<?php $this->permalink() ?>"><?php $this->sticky();$this->title() ?></a>
|
||||
</h2>
|
||||
<h3 class="article-subtitle">
|
||||
<?php // 判断是否存在自定义字段summary并输出,否则输出自动生成的摘要
|
||||
if($this->fields->summary){
|
||||
echo $this->fields->summary;
|
||||
} else {
|
||||
$this->excerpt(200);
|
||||
}?>
|
||||
</h3>
|
||||
</div>
|
||||
<footer class="article-time">
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-calendar-time" width="56" height="56" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<path d="M11.795 21h-6.795a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4" />
|
||||
<circle cx="18" cy="18" r="4" />
|
||||
<path d="M15 3v4" />
|
||||
<path d="M7 3v4" />
|
||||
<path d="M3 11h16" />
|
||||
<path d="M18 16.496v1.504l1 1" />
|
||||
</svg>
|
||||
<time class="article-time--published"><?php $this->date(); ?></time>
|
||||
</div>
|
||||
<div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-clock" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<circle cx="12" cy="12" r="9" />
|
||||
<polyline points="12 7 12 12 15 15" />
|
||||
</svg>
|
||||
<time class="article-time--reading">
|
||||
<?php $content = $this->content; // 获取文章内容 ?><?php $readingTime = getReadingTime($content); // 计算阅读时间 ?><?php echo isset($readingTime) ? $readingTime . ' minutes' : '未知'; ?> read
|
||||
</time>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
</header>
|
||||
</article>
|
||||
<?php endif; ?>
|
||||
<?php endwhile; ?>
|
||||
<?php $this->pagenav(
|
||||
'', '', 1,'...',
|
||||
array(
|
||||
'wrapTag' => 'nav',// 整个分页导航的外围HTML标签
|
||||
'wrapClass' => 'pagination',// 整个分页导航的CSS类
|
||||
'itemTag' => '',// 每个分页项的HTML标签
|
||||
'textTag' => 'span class="page-link dots"',// 文本(页码)的HTML标签
|
||||
'itemClass' => 'page-link', // 所有分页项的CSS类
|
||||
'currentClass' => 'page-link current',// 当前页码的CSS类
|
||||
'prevClass' => 'hidden',//“前一页”按钮的CSS类
|
||||
'nextClass' => 'hidden' // “后一页”按钮的CSS类
|
||||
)
|
||||
);
|
||||
?>
|
|
@ -0,0 +1,70 @@
|
|||
<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
<aside class="sidebar right-sidebar sticky">
|
||||
<form id="search" method="post" action="./" role="search" class="search-form widget">
|
||||
<label>Search</label>
|
||||
<input type="text" name="s" class="search-field text" placeholder="站内搜索" required/>
|
||||
<button type="submit" class="search-submit submit">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-search" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/><circle cx="10" cy="10" r="7" /><line x1="21" y1="21" x2="15" y2="15" />
|
||||
</svg>
|
||||
</button>
|
||||
</form>
|
||||
<?php if ($this->options->showgd): ?>
|
||||
<!-- 归档开始 -->
|
||||
<section class="widget archives">
|
||||
<div class="widget-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-infinity" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<path d="M9.828 9.172a4 4 0 1 0 0 5.656 a10 10 0 0 0 2.172 -2.828a10 10 0 0 1 2.172 -2.828 a4 4 0 1 1 0 5.656a10 10 0 0 1 -2.172 -2.828a10 10 0 0 0 -2.172 -2.828" />
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="widget-title section-title">归档</h2>
|
||||
<div class="widget-archive--list">
|
||||
<?php $this->widget('Widget_Contents_Post_Date', 'type=month&format=Y年m月')->parse('
|
||||
<div class="archives-year">
|
||||
<a href="{permalink}">
|
||||
<span class="year">{date}</span>
|
||||
<span class="count">{count} </span>
|
||||
</a>
|
||||
</div>
|
||||
'); ?>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<!-- 分类开始 -->
|
||||
<section class="widget tagCloud">
|
||||
<div class="widget-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-hash" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<line x1="5" y1="9" x2="19" y2="9" />
|
||||
<line x1="5" y1="15" x2="19" y2="15" />
|
||||
<line x1="11" y1="4" x2="7" y2="20" />
|
||||
<line x1="17" y1="4" x2="13" y2="20" />
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="widget-title section-title">分类</h2>
|
||||
<div class="tagCloud-tags">
|
||||
<?php $this->widget('Widget_Metas_Category_List')->parse('<a href="{permalink}" class="font_size_1"> {name}</a> '); ?>
|
||||
</div>
|
||||
</section>
|
||||
<!-- 标签开始 -->
|
||||
<section class="widget tagCloud">
|
||||
<div class="widget-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-tag" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<path d="M11 3L20 12a1.5 1.5 0 0 1 0 2L14 20a1.5 1.5 0 0 1 -2 0L3 11v-4a4 4 0 0 1 4 -4h4" />
|
||||
<circle cx="9" cy="9" r="2" />
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="widget-title section-title">标签</h2>
|
||||
<?php $this->widget('Widget_Metas_Tag_Cloud', 'sort=mid&ignoreZeroCount=1&desc=0&limit=20')->to($tags); ?>
|
||||
<?php if($tags->have()): ?>
|
||||
<div class="tagCloud-tags">
|
||||
<?php while ($tags->next()): ?>
|
||||
<a class="font_size_1" target="<?php $this->options->sidebarLinkOpen(); ?>" data-toggle="tooltip" data-placement="top" href="<?php $tags->permalink(); ?>" rel="tag" title="<?php $tags->count(); ?> 篇文章"><?php $tags->name(); ?></a>
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<p class="font_size_1"><?php _e('暂无标签'); ?></p>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
</aside>
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
function generate_toc($content) {
|
||||
$toc = '<aside class="sidebar right-sidebar sticky">
|
||||
<section class="widget archives">
|
||||
<div class="widget-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-hash" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<line x1="5" y1="9" x2="19" y2="9" />
|
||||
<line x1="5" y1="15" x2="19" y2="15" />
|
||||
<line x1="11" y1="4" x2="7" y2="20" />
|
||||
<line x1="17" y1="4" x2="13" y2="20" />
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="widget-title section-title">文章目录</h2>
|
||||
<div class="widget--toc">
|
||||
<nav id="TableOfContents">
|
||||
';
|
||||
|
||||
// 初始化变量
|
||||
$has_toc = false;
|
||||
|
||||
// 使用正则表达式提取标题
|
||||
if (preg_match_all('/<h([1-6])>(.*?)<\/h\1>/', $content, $matches, PREG_SET_ORDER)) {
|
||||
$current_level = 0;
|
||||
foreach ($matches as $match) {
|
||||
$level = intval($match[1]);
|
||||
$title = strip_tags($match[2]);
|
||||
$id = $title; // 保留标题原有格式
|
||||
|
||||
// 根据标题层级生成嵌套列表
|
||||
if ($level > $current_level) {
|
||||
$toc .= '<ol>';
|
||||
} elseif ($level < $current_level) {
|
||||
$toc .= str_repeat('</ol>', $current_level - $level);
|
||||
}
|
||||
|
||||
$toc .= '<li><a href="#' . htmlspecialchars($id) . '">' . htmlspecialchars($title) . '</a>';
|
||||
|
||||
// 检查下一个标题是否是下一级,如果是则在这里闭合 li,以便包含子 ol
|
||||
if ($level >= $current_level) {
|
||||
$toc .= '</li>';
|
||||
}
|
||||
|
||||
$current_level = $level;
|
||||
$has_toc = true;
|
||||
}
|
||||
|
||||
// 关闭所有打开的列表标签
|
||||
if ($current_level > 0) {
|
||||
$toc .= str_repeat('</ol>', $current_level);
|
||||
}
|
||||
}
|
||||
|
||||
$toc .= '
|
||||
</nav>
|
||||
</div>
|
||||
</section>
|
||||
</aside>';
|
||||
|
||||
// 如果没有 TOC 内容,则返回空字符串
|
||||
return $has_toc ? $toc : '';
|
||||
}
|
||||
?>
|
Loading…
Reference in New Issue