🍻 Add `.Site.BaseURL`

This commit is contained in:
nanxiaobei 2018-07-06 04:17:31 +08:00
parent cb2786f9b2
commit d22829882a
2 changed files with 9 additions and 8 deletions

View File

@ -13,7 +13,7 @@
{{ if .Params.tags }} {{ if .Params.tags }}
<ul class="post-tags"> <ul class="post-tags">
{{ range .Params.tags }} {{ range .Params.tags }}
<li><a href="{{ `/tags/` }}{{ . | urlize }}/">{{ . }}</a></li> <li><a href="{{$.Site.BaseURL}}tags/{{ . | urlize }}">{{ . }}</a></li>
{{ end }} {{ end }}
</ul> </ul>
{{ end }} {{ end }}
@ -25,7 +25,8 @@
<script> <script>
var disqus_shortname = '{{ .Site.DisqusShortname }}'; var disqus_shortname = '{{ .Site.DisqusShortname }}';
(function() { // DON'T EDIT BELOW THIS LINE (function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script'); var d = document,
s = d.createElement('script');
s.src = 'https://' + disqus_shortname + '.disqus.com/embed.js'; s.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date()); s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s); (d.head || d.body).appendChild(s);

View File

@ -25,21 +25,21 @@
<!-- Styles --> <!-- Styles -->
<link href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700,700i" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=PT+Sans:400,400i,700,700i" rel="stylesheet">
<link href="https://cdn.bootcss.com/highlight.js/9.12.0/styles/default.min.css" rel="stylesheet"> <link href="https://cdn.bootcss.com/highlight.js/9.12.0/styles/default.min.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet"> <link href="{{.Site.BaseURL}}css/style.css" rel="stylesheet">
<!-- Favicons --> <!-- Favicons -->
<link rel="apple-touch-icon" href="/img/apple-touch-icon.png"> <link rel="apple-touch-icon" href="{{.Site.BaseURL}}img/apple-touch-icon.png">
<link rel="icon" href="/img/favicon.ico"> <link rel="icon" href="{{.Site.BaseURL}}img/favicon.ico">
<!-- Generator --> <!-- Generator -->
<meta name="generator" content="Hugo {{ .Hugo.Version }}"> <meta name="generator" content="Hugo {{ .Hugo.Version }}">
<!-- RSS --> <!-- RSS -->
<link rel="alternate" type="application/atom+xml" href="/index.xml" title="{{ .Site.Title }}"> <link rel="alternate" type="application/atom+xml" href="{{.Site.BaseURL}}index.xml" title="{{ .Site.Title }}">
</head> </head>
<body class="{{if eq .Kind `page` }}single{{else}}list{{ if .IsHome }} home{{ end }}{{end}}"> <body class="{{if eq .Kind `page` }}single{{else}}list{{ if .IsHome }} home{{ end }}{{end}}">
<header class="header"> <header class="header">
{{ if .IsHome }} {{ if .IsHome }}
<h1 class="title"><a href="{{ `/` }}">{{ .Site.Title }}</a></h1> <h1 class="title"><a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a></h1>
{{ else }} {{ else }}
<p class="title"><a href="{{ `/` }}">{{ .Site.Title }}</a></p> <p class="title"><a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a></p>
{{ end }} {{ end }}
<button class="menu-toggle" type="button"></button> <button class="menu-toggle" type="button"></button>
<nav class="menu"> <nav class="menu">