Layout change #6

This commit is contained in:
koirand 2019-03-23 16:18:03 +09:00
parent a821794a91
commit 1f9e6368c9
10 changed files with 210 additions and 182 deletions

View file

@ -1,14 +1,14 @@
<!DOCTYPE html>
<html>
{{ partial "head.html" . }}
<body>
{{ partial "header.html" . }}
<div class="main">
<div>
<h1>404 page not found.</h1>
<p><a href="/">Go Home</a></p>
</div>
</div>
{{ partial "footer.html" . }}
</body>
{{ partial "head.html" . }}
<body>
{{ partial "header.html" . }}
<div class="main">
<div>
<h1>404 page not found.</h1>
<p><a href="/">Go Home</a></p>
</div>
</div>
{{ partial "footer.html" . }}
</body>
</html>

View file

@ -1,12 +1,7 @@
<!DOCTYPE html>
<html>
{{ partial "head.html" . }}
<body>
{{ partial "header.html" . }}
<div class="main">
{{ block "main" . }}{{ end }}
</div>
{{ partial "footer.html" . }}
</body>
{{ partial "head.html" . }}
<body>
{{ block "main" . }}{{ end }}
</body>
</html>

View file

@ -1,22 +1,27 @@
{{ define "main"}}
<div>
<div class="searchBoxContainer">
<input type="text" id="searchBox" class="searchBox" placeholder="Search..." />
<img id="searchBoxIcon" class="searchBoxIcon" src="/img/search.png" />
</div>
<div id="searchResults" class="searchResults"></div>
{{ range $index, $value := .Pages.GroupByDate .Site.Params.listPageDateFormat }}
{{ if (ne $index 0) }}
<hr class="separator">
{{ end }}
<p class="date">{{ .Key }}</p>
{{ range .Pages }}
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
{{ end }}
{{ end }}
</div>
<script src="/js/jquery-3.3.1.min.js"></script>
<script src="/js/jquery.mark.es6.min.js"></script>
<script src="/js/fuse.min.js"></script>
<script src="/js/search.js"></script>
{{ partial "header.html" . }}
<!-- search box -->
<div id="searchBox">
<input type="text" id="searchBoxInput" placeholder="Search..." />
<img id="searchBoxIcon" src="/img/search.png" />
</div>
<!-- search results -->
<div id="searchResults"></div>
<!-- contents -->
<div id="contentsList">
{{ range $index, $value := .Pages.GroupByDate .Site.Params.listPageDateFormat }}
{{ if (ne $index 0) }}
<hr class="separator">
{{ end }}
<p class="date">{{ .Key }}</p>
{{ range .Pages }}
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
{{ end }}
{{ end }}
</div>
{{ partial "footer.html" . }}
<script src="/js/jquery-3.3.1.min.js"></script>
<script src="/js/jquery.mark.es6.min.js"></script>
<script src="/js/fuse.min.js"></script>
<script src="/js/search.js"></script>
{{ end }}

View file

@ -1,10 +1,11 @@
{{ define "main"}}
<div>
<h1>{{ .Title }}</h1>
<p class="date">{{ .Date.Format .Site.Params.singlePageDateFormat }}</p>
<div class="markdown-body">
{{ .Content }}
</div>
</div>
<h1>{{ .Title }}</h1>
{{ partial "header.html" . }}
<!-- date -->
<p class="date">{{ .Date.Format .Site.Params.singlePageDateFormat }}</p>
<!-- content -->
<div class="markdown-body">
{{ .Content }}
</div>
{{ partial "footer.html" . }}
{{ end }}

View file

@ -1,26 +1,32 @@
<!DOCTYPE html>
<html>
{{- partial "head.html" . -}}
<body>
<div class="profile">
<div class="profile-body">
<div class="avatar">
<img class="avatar-mask" src="/img/{{ .Site.Params.avatar }}">
<img src="/img/avatar-border.svg">
</div>
<h1 class="author">{{ .Site.Params.Author }}</h1>
<p>
{{ .Site.Params.discription }}
</p>
<nav>
<ul>
{{ range .Site.Menus.main }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
</nav>
</div>
</div>
{{- partial "footer.html" . -}}
</body>
{{- partial "head.html" . -}}
<body>
<div id="profileContainer">
<div id="profile">
<header>
<!-- avator -->
<div class="avatar">
<img class="avatarMask" src="/img/{{ .Site.Params.avatar }}" alt="avatar">
<img src="/img/avatar-border.svg" alt="avatar-border">
</div>
<!-- author -->
<h1 class="author">{{ .Site.Params.Author }}</h1>
</header>
<!-- discription -->
<p>
{{ .Site.Params.discription }}
</p>
<!-- navigation -->
<nav>
<ul>
{{ range .Site.Menus.main }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
</ul>
</nav>
</div>
</div>
{{- partial "footer.html" . -}}
</body>
</html>

View file

@ -1,9 +1,9 @@
<footer>
<p>
&copy; {{ .Site.Params.publicationYear }} {{ .Site.Params.Author }}.
Powered by <a href="https://gohugo.io/">Hugo</a>
using the <a href="https://github.com/koirand/pulp/">pulp</a> theme.
</p>
<p>
&copy; {{ .Site.Params.publicationYear }} {{ .Site.Params.Author }}.
Powered by <a href="https://gohugo.io/">Hugo</a>
using the <a href="https://github.com/koirand/pulp/">pulp</a> theme.
</p>
</footer>
{{- range .Site.Params.custom_js -}}
<script src="{{ . }}"></script>

View file

@ -1,45 +1,45 @@
<head>
<title>
{{ if eq .Title .Site.Title }}
{{ .Site.Title }}
{{ else }}
{{ .Title }} - {{ .Site.Title }}
{{ end }}
</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="{{ .Site.Author }}" />
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">
<title>
{{ if eq .Title .Site.Title }}
{{ .Site.Title }}
{{ else }}
{{ .Title }} - {{ .Site.Title }}
{{ end }}
</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="{{ .Site.Author }}" />
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico">
<!-- css -->
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/markdown.css">
<link rel="stylesheet" href="/css/syntax-highlight.css">
<!-- css -->
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/markdown.css">
<link rel="stylesheet" href="/css/syntax-highlight.css">
<!-- custom css -->
{{ range .Site.Params.custom_css }}
<link rel="stylesheet" href="{{ . }}">
{{ end }}
<!-- custom css -->
{{ range .Site.Params.custom_css }}
<link rel="stylesheet" href="{{ . }}">
{{ end }}
{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}}
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/google_news.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}}
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/google_news.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
<!-- Polyfill for old browsers -->
{{ `<!--[if lte IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
<![endif]-->` | safeHTML }}
<!-- Polyfill for old browsers -->
{{ `<!--[if lte IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.1.20170427/classList.min.js"></script>
<![endif]-->` | safeHTML }}
{{ `<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->` | safeHTML }}
{{ `<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->` | safeHTML }}
<!-- Analytics -->
{{- if and (not .Site.IsServer) .Site.GoogleAnalytics -}}
{{ template "_internal/google_analytics_async.html" . }}
{{- end -}}
<!-- Analytics -->
{{- if and (not .Site.IsServer) .Site.GoogleAnalytics -}}
{{ template "_internal/google_analytics_async.html" . }}
{{- end -}}
</head>

View file

@ -1,6 +1,9 @@
<header>
<div class="avatar">
<img class="avatar-mask" src="/img/{{ .Site.Params.avatar }}">
<a href="/"><img src="/img/avatar-border.svg"></a>
</div>
</header>
<!-- avator -->
<div class="avatar">
<img class="avatarMask" src="/img/{{ .Site.Params.avatar }}">
<a href="/"><img src="/img/avatar-border.svg"></a>
</div>
<!-- author -->
<h2><a class="author" href="/">{{ .Site.Params.Author }}</a></h2>
</header>

View file

@ -1,5 +1,9 @@
/* General */
body {
min-height:100vh;
margin: 0;
padding: 20px;
box-sizing:border-box;
background-color: #EFEFEF;
color: #707070;
text-align: center;
@ -7,20 +11,6 @@ body {
line-height: 1.5;
}
header {
padding: 30px 0;
}
footer {
font-size: 12px;
}
hr.separator {
width: 10px;
margin: 30px auto;
border: solid 1px #C9C9C9;
}
a:link {
color: #707070;
}
@ -37,19 +27,6 @@ a:active {
color: #707070;
}
div.profile {
min-height: calc(100vh - 42px);
display: flex;
justify-content: center;
align-items: center;
}
div.profile-body {
width: 60vw;
max-width: 400px;
min-width: 300px;
}
.author {
color: #C39F59;
}
@ -58,12 +35,13 @@ div.profile-body {
color: #869D38;
}
div.avatar {
/* Header */
header .avatar {
position: relative;
height: 100px;
}
div.avatar img {
header .avatar img {
position: absolute;
width: 100px;
margin: 0 auto;
@ -71,25 +49,44 @@ div.avatar img {
right: 0;
}
div.avatar img.avatar-mask {
header .avatarMask {
clip-path: circle(48px at center);
-webkit-clip-path: circle(48px at center);
}
div.main {
display: flex;
justify-content: center;
min-height: calc(100vh - 202px);
min-width: 300px;
margin: 0 10px;
header a.author:link {
color: #C39F59;
}
div.markdown-body {
width: 90vw;
max-width: 800px;
header a.author:visited {
color: #C39F59;
}
header a.author:hover {
color: #C39F59;
}
header a.author:active {
color: #C39F59;
}
/* Footer */
footer {
font-size: 12px;
box-sizing:border-box;
}
/* Top page */
#profileContainer {
min-height: calc(100vh - 100px);
display: flex;
justify-content: center;
align-items: center;
}
#profile {
max-width: 600px;
min-width: 300px;
margin: 40px auto;
text-align: left;
}
nav ul {
@ -101,14 +98,15 @@ nav ul {
list-style: none;
}
div.searchBoxContainer {
/* Contents List */
#searchBox {
position: relative;
width: 300px;
height: 30px;
margin: 10px auto 50px auto;
margin: 20px auto;
}
input.searchBox {
#searchBox #searchBoxInput {
position: absolute;
width: 100%;
padding: 0 35px 0 15px;
@ -125,17 +123,25 @@ input.searchBox {
box-sizing: border-box;
}
input.searchBox::placeholder {
#searchBox #searchBoxInput::placeholder {
color: #c9c9c9;
}
div.searchResults {
#searchBox #searchBoxIcon {
position: absolute;
height: 20px;
width: 20px;
top: 5px;
right: 10px;
}
#searchResults {
display: none;
position: absolute;
max-width: 600px;
min-width: 300px;
margin: 0 auto;
top: 210px;
top: 240px;
left: 0;
right: 0;
padding: 5px;
@ -146,27 +152,39 @@ div.searchResults {
box-sizing: border-box;
}
div.searchResultPage {
#searchResults .searchResultPage {
padding: 20px
}
div.searchResultTitle {
#searchResults .searchResultTitle {
font-weight: bold;
margin: 5px 0;
}
div.searchResultBody {
#searchResults .searchResultBody {
font-size: 14px;
}
img.searchBoxIcon {
position: absolute;
height: 20px;
width: 20px;
top: 5px;
right: 10px;
}
mark {
#searchResults mark {
background-color: #dddfdf;
}
#contentsList {
padding: 20px;
}
#contentsList hr.separator {
width: 10px;
margin: 30px auto;
border: solid 1px #C9C9C9;
}
/* Page */
div.markdown-body {
width: 90vw;
max-width: 800px;
min-width: 300px;
margin: 0 auto;
padding: 20px;
text-align: left;
}

View file

@ -26,12 +26,12 @@ function initSearch () {
function initUI () {
// Clear query when clear icon is clicked
$('#searchBoxIcon').click(function () {
$('#searchBox').val('')
$('#searchBox').trigger('keyup')
$('#searchBoxInput').val('')
$('#searchBoxInput').trigger('keyup')
})
// Event when chenging query
$('#searchBox').keyup(function () {
$('#searchBoxInput').keyup(function () {
var $searchResults = $('#searchResults')
var query = $(this).val().trim()
@ -56,7 +56,7 @@ function initUI () {
})
// Emit keyup event for when the query is already setted with browser back etc.
$('#searchBox').trigger('keyup')
$('#searchBoxInput').trigger('keyup')
}
/**
@ -65,7 +65,7 @@ function initUI () {
*/
function renderResults (results) {
var $searchResults = $('#searchResults')
var query = $('#searchBox').val()
var query = $('#searchBoxInput').val()
var SUMMARY_INCLUDE = 50
var MAX_PAGES = 10