Fix&complete header&footer

This commit is contained in:
Skywt2003 2021-08-04 20:47:28 +08:00
parent 6accfaef67
commit 868386a44d
2 changed files with 54 additions and 56 deletions

View File

@ -78,16 +78,16 @@
<!-- 如果 nav 放在 header 里,这个 sticky-top 就会被限制在 header 里,暂时只能这么写 --> <!-- 如果 nav 放在 header 里,这个 sticky-top 就会被限制在 header 里,暂时只能这么写 -->
<nav class="navbar navbar-light navbar-expand sticky-top"> <nav class="navbar navbar-light navbar-expand sticky-top">
<div class="container"> <div class="container">
<ul class="col navbar-nav justify-content-center"> <ul class="col navbar-nav justify-content-center pr-0">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link nav-link-icon <?php if ($this->is('index')){echo 'text-default';}else{echo 'text-gray';}?>" href="<?php $this->options->siteUrl();?>"> <a class="nav-link nav-link-icon <?php if ($this->is('index')){echo 'text-default';}else{echo 'text-gray';}?>" href="<?php $this->options->siteUrl();?>">
<i class="fa fa-home"></i> Home <i class="fa fa-home"></i> <?php _e('首页') ?>
</a> </a>
</li> </li>
<?php if (strpos($this->options->frontPage, 'file') !== FALSE) {?> <?php if (strpos($this->options->frontPage, 'file') !== FALSE) {?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link nav-link-icon <?php if ($this->is('archive')){echo 'text-default';}else{echo 'text-gray';}?>" href="<?php echo $this->options->siteUrl.$this->options->routingTable['archive']['url'] ?>"> <a class="nav-link nav-link-icon <?php if ($this->is('archive')){echo 'text-default';}else{echo 'text-gray';}?>" href="<?php echo $this->options->siteUrl.$this->options->routingTable['archive']['url'] ?>">
<i class="fa fa-book"></i> Passages <i class="fa fa-book"></i> <?php _e('文章') ?>
</a> </a>
</li> </li>
<?php } ?> <?php } ?>
@ -105,6 +105,7 @@
</ul> </ul>
</div> </div>
</nav> </nav>
<script>$(document).ready(function(){$(".navbar ul.navbar-nav li:last-child").addClass("mr-0");});</script>
<div id="body"> <div id="body">
<div class="container"> <div class="container">

View File

@ -5,6 +5,7 @@
* @package index * @package index
*/ */
if (!defined('__TYPECHO_ROOT_DIR__')) exit; if (!defined('__TYPECHO_ROOT_DIR__')) exit;
$this->need('functions.php'); // 不知道为啥,似乎模版页面不会自动引用 functions.php
?> ?>
<!DOCTYPE HTML> <!DOCTYPE HTML>
<html> <html>
@ -49,7 +50,6 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit;
<body> <body>
<div class="flex-container"> <div class="flex-container">
<header id="header" class="clearfix mb-4"> <header id="header" class="clearfix mb-4">
<div class="container"> <div class="container">
<div class="row"> <div class="row">
@ -68,19 +68,18 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit;
</div><!-- end .row --> </div><!-- end .row -->
</div> </div>
</header><!-- end #header --> </header><!-- end #header -->
<nav class="navbar navbar-light navbar-expand sticky-top"> <nav class="navbar navbar-light navbar-expand sticky-top">
<div class="container"> <div class="container">
<ul class="col navbar-nav justify-content-center"> <ul class="col navbar-nav justify-content-center pr-0">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link nav-link-icon text-gray" href="<?php $this->options->siteUrl();?>"> <a class="nav-link nav-link-icon text-gray" href="<?php $this->options->siteUrl();?>">
<i class="fa fa-home"></i> Home <i class="fa fa-home"></i> <?php _e('首页') ?>
</a> </a>
</li> </li>
<?php if (strpos($this->options->frontPage, 'file') !== FALSE) {?> <?php if (strpos($this->options->frontPage, 'file') !== FALSE) {?>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link nav-link-icon text-gray" href="<?php echo $this->options->siteUrl.$this->options->routingTable['archive']['url'] ?>"> <a class="nav-link nav-link-icon text-gray" href="<?php echo $this->options->siteUrl.$this->options->routingTable['archive']['url'] ?>">
<i class="fa fa-book"></i> Passages <i class="fa fa-book"></i> <?php _e('文章') ?>
</a> </a>
</li> </li>
<?php } ?> <?php } ?>
@ -98,10 +97,10 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit;
</ul> </ul>
</div> </div>
</nav> </nav>
</div> </div>
<script>$(document).ready(function(){$(".navbar ul.navbar-nav li:last-child").addClass("mr-0");});</script>
<footer class="flex-footer" id="footer" role="footer"> <footer class="mt-5 mb-5" id="footer" role="footer">
<div class="container"> <div class="container">
<hr> <hr>
<div class="text-center"> <div class="text-center">
@ -115,14 +114,12 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit;
<a href="<?php $this->options->siteUrl();?>sitemap.xml">Sitemap</a> | <a href="<?php $this->options->siteUrl();?>sitemap.xml">Sitemap</a> |
<a href="<?php $this->options->siteUrl();?>links">Links</a> <a href="<?php $this->options->siteUrl();?>links">Links</a>
</p> </p>
<p>&copy; <?php echo date('Y');?> <?php $this->options->title(); ?> ♥ <?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?><?php $stat->publishedPostsNum() ?> Posts <?php $this->allOfCharacters();?> Words crafted</p> <p>&copy; <?php echo date('Y');?> <?php $this->options->title(); ?> ♥ <?php Typecho_Widget::widget('Widget_Stat')->to($stat); ?><?php $stat->publishedPostsNum() ?> Posts <?php allOfCharacters();?> Words crafted</p>
<p>Powered by <a href="https://www.typecho.org">Typecho</a> | Theme <a href="https://skywt.cn/sky-theme">Sky</a> by <a href="https://skywt.cn/">SkyWT</a></p> <p>Powered by <a href="https://www.typecho.org">Typecho</a> | Theme <a href="https://skywt.cn/sky-theme">Sky</a> by <a href="https://skywt.cn/">SkyWT</a></p>
</div> </div>
</div> </div>
</footer><!-- end #footer --> </footer><!-- end #footer -->
<!--<pre><?php #print_r($this); ?></pre>-->
<?php $this->footer(); ?> <?php $this->footer(); ?>
</body> </body>