Do not only use ugly URLs; have support for relative or ugly

This commit is contained in:
Tony Blyler 2016-11-03 21:14:36 -04:00
parent ddcf6a28d0
commit b781218f4e
4 changed files with 16 additions and 17 deletions

View file

@ -5,7 +5,7 @@
<h2>{{ .Key }}</h2> <h2>{{ .Key }}</h2>
{{ range .Pages }} {{ range .Pages }}
<h3> <h3>
<a href="{{ .Permalink }}"> <a href="{{ .RelPermalink }}">
{{ .Title }} {{ if .GetParam "draft" }}DRAFT{{ end }} {{ .Title }} {{ if .GetParam "draft" }}DRAFT{{ end }}
</a> </a>
</h3> </h3>

View file

@ -1,10 +1,10 @@
<div class="links"> <div class="links">
<a href="{{ .Site.BaseURL }}">Home</a> <a href="/">Home</a>
{{ range first 1 (where .Site.Pages "Type" "post") }} {{ range first 1 (where .Site.Pages "Type" "post") }}
<a href="{{ .Site.BaseURL }}/post/">Archive</a> <a href="/post/">Archive</a>
{{ end }} {{ end }}
{{ range where .Site.Pages "Type" "!=" "post" }} {{ range where .Site.Pages "Type" "!=" "post" }}
<a href="{{ .Permalink }}">{{ .Title }}</a> <a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ end }} {{ end }}
<a href="#top">Top</a> <a href="#top">Top</a>
</div> </div>

View file

@ -4,15 +4,14 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
<title>{{ .Title }} &middot; {{ .Site.Title }}</title> <title>{{ .Title }} &middot; {{ .Site.Title }}</title>
<base href="{{ .Permalink }}">
<link rel="canonical" href="{{ .Permalink }}"> <link rel="canonical" href="{{ .Permalink }}">
<link rel="stylesheet" type="text/css" href="{{ .Site.BaseURL }}/css/main.css" /> <link rel="stylesheet" type="text/css" href="/css/main.css" />
{{ if .RSSlink }} {{ if .RSSlink }}
<link href="{{ .RSSlink }}" rel="alternative" type="application/rss+xml" title="{{ .Title }}" /> <link href="{{ .RSSlink }}" rel="alternative" type="application/rss+xml" title="{{ .Title }}" />
{{ end }} {{ end }}
</head> </head>
<body> <body>
<a id="title" href="{{ .Site.BaseURL }}" title="{{ .Site.Title }}"> <a id="title" href="/" title="{{ .Site.Title }}">
{{ if .Site.Params.logo }} {{ if .Site.Params.logo }}
<img id="logo" alt="Logo" src="{{ .Site.Params.logo }}" /> <img id="logo" alt="Logo" src="{{ .Site.Params.logo }}" />
{{ end }} {{ end }}
@ -24,27 +23,27 @@
{{ $icon_size := "64px" }} {{ $icon_size := "64px" }}
{{ if .Site.Params.email }} {{ if .Site.Params.email }}
<a href="mailto:{{ .Site.Params.email }}" title="Email"> <a href="mailto:{{ .Site.Params.email }}" title="Email">
<img alt="Email" height="{{ $icon_size }}" width="{{ $icon_size }}" src="{{ .Site.BaseURL }}/images/email.svg" /> <img alt="Email" height="{{ $icon_size }}" width="{{ $icon_size }}" src="/images/email.svg" />
</a> </a>
{{ end }} {{ end }}
{{ if .Site.Params.github }} {{ if .Site.Params.github }}
<a href="https://github.com/{{ .Site.Params.github }}" title="Github"> <a href="https://github.com/{{ .Site.Params.github }}" title="Github">
<img alt="GitHub" height="{{ $icon_size }}" width="{{ $icon_size }}" src="{{ .Site.BaseURL }}/images/github.svg" /> <img alt="GitHub" height="{{ $icon_size }}" width="{{ $icon_size }}" src="/images/github.svg" />
</a> </a>
{{ end }} {{ end }}
{{ if .Site.Params.facebook }} {{ if .Site.Params.facebook }}
<a href="https://facebook.com/{{ .Site.Params.facebook }}" title="Facebook"> <a href="https://facebook.com/{{ .Site.Params.facebook }}" title="Facebook">
<img alt="Facebook" height="{{ $icon_size }}" width="{{ $icon_size }}" src="{{ .Site.BaseURL }}/images/facebook.svg" /> <img alt="Facebook" height="{{ $icon_size }}" width="{{ $icon_size }}" src="/images/facebook.svg" />
</a> </a>
{{ end }} {{ end }}
{{ if .Site.Params.twitter }} {{ if .Site.Params.twitter }}
<a href="https://twitter.com/{{ .Site.Params.twitter }}" title="Twitter"> <a href="https://twitter.com/{{ .Site.Params.twitter }}" title="Twitter">
<img alt="Twitter" height="{{ $icon_size }}" width="{{ $icon_size }}" src="{{ .Site.BaseURL }}/images/twitter.svg" /> <img alt="Twitter" height="{{ $icon_size }}" width="{{ $icon_size }}" src="/images/twitter.svg" />
</a> </a>
{{ end }} {{ end }}
{{ if .Site.Params.linkedin }} {{ if .Site.Params.linkedin }}
<a href="https://linkedin.com/in/{{ .Site.Params.linkedin }}" title="LinkedIn"> <a href="https://linkedin.com/in/{{ .Site.Params.linkedin }}" title="LinkedIn">
<img alt="LinkedIn" height="{{ $icon_size }}" width="{{ $icon_size }}" src="{{ .Site.BaseURL }}/images/linkedin.svg" /> <img alt="LinkedIn" height="{{ $icon_size }}" width="{{ $icon_size }}" src="/images/linkedin.svg" />
</a> </a>
{{ end }} {{ end }}
</div> </div>
@ -52,11 +51,11 @@
<p>{{ .Site.Params.description }}</p> <p>{{ .Site.Params.description }}</p>
{{ end }} {{ end }}
<div class="links"> <div class="links">
<a href="{{ .Site.BaseURL }}">Home</a> <a href="/">Home</a>
{{ range first 1 (where .Site.Pages "Type" "post") }} {{ range first 1 (where .Site.Pages "Type" "post") }}
<a href="{{ .Site.BaseURL }}/post/">Archive</a> <a href="/post/">Archive</a>
{{ end }} {{ end }}
{{ range where .Site.Pages "Type" "!=" "post" }} {{ range where .Site.Pages "Type" "!=" "post" }}
<a href="{{ .Permalink }}">{{ .Title }}</a> <a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ end }} {{ end }}
</div> </div>

View file

@ -2,7 +2,7 @@
<article class="post"> <article class="post">
<header> <header>
<h1> <h1>
<a href="{{ .Permalink }}">{{ .Title }} {{ if .Draft }}:: DRAFT{{end}}</a> <a href="{{ .RelPermalink }}">{{ .Title }} {{ if .Draft }}:: DRAFT{{end}}</a>
</h1> </h1>
<span class="post-meta"> <span class="post-meta">
{{ .Date.Format "Mon, Jan 2, 2006" }} - Read in {{ .ReadingTime }} Min {{ .Date.Format "Mon, Jan 2, 2006" }} - Read in {{ .ReadingTime }} Min
@ -10,7 +10,7 @@
</header> </header>
<div class="summary"> <div class="summary">
{{ .Summary }} {{ .Summary }}
<a href="{{ .Permalink }}">Read more...</a> <a href="{{ .RelPermalink }}">Read more...</a>
</div> </div>
</article> </article>
</div> </div>