diff options
author | Darshan Baral <darshanbaral@gmail.com> | 2020-01-16 21:26:58 +0300 |
---|---|---|
committer | Darshan Baral <darshanbaral@gmail.com> | 2020-01-16 21:26:58 +0300 |
commit | bd2cddc8585aca48d1c184957665f289a8a25b50 (patch) | |
tree | dd37f154682d9edb76836711511c837c028f9cc8 | |
parent | cf9ecc4a418fd5dd78a7a04e6454358c3e79e5ab (diff) |
Added blog
-rw-r--r-- | exampleSite/config.toml | 2 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 11 | ||||
-rw-r--r-- | layouts/_default/list.html | 7 | ||||
-rw-r--r-- | layouts/_default/single.html | 13 | ||||
-rw-r--r-- | layouts/index.html | 2 | ||||
-rw-r--r-- | layouts/partials/footer.html | 2 | ||||
-rw-r--r-- | layouts/partials/head.html | 63 | ||||
-rw-r--r-- | layouts/partials/header.html | 5 | ||||
-rw-r--r-- | layouts/partials/metadata.html | 18 | ||||
-rw-r--r-- | layouts/partials/prevnext.html | 26 | ||||
-rw-r--r-- | layouts/partials/toggleTheme.html | 33 |
11 files changed, 79 insertions, 103 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index a68f84d..be366df 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -9,10 +9,8 @@ theme = "aafu" copyright = "aaa"
[params.theme]
- allowToggle = true
# Available themes are 'light', 'dark', and 'pinkish'
mainTheme = "light"
- altTheme = "dark"
# setting false below will hide 'aafu by darshan' displayed under the profile pic
showAttribute = true
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 0e1ac85..0365dcb 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -2,8 +2,13 @@ <html lang="{{ .Site.LanguageCode }}"> {{- partial "head.html" . -}} <body class="container"> - {{ partial "header" . }} - {{- block "main" . }} - {{- end }} + <main style="min-height: calc(100vh - 60px);"> + {{ partial "header" . }} + {{- block "main" . }} + {{- end }} + </main> + {{ if not .IsHome }} + {{ partial "footer" . }} + {{ end }} </body> </html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 79a98f1..fb4aa13 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,18 +1,17 @@ {{ define "main" }} -<h1 class="standard top-h1 mt-4 mb-4"> +<h1 class="standard top-h1 mb-3"> {{- .Title -}} </h1> <div class="standard grid-container"> - {{ range (.Paginator 2).Pages }} + {{ range (.Paginator 10).Pages }} <div class="index-box p-3 shadow rounded mb-4"> - <p class="mb-0">{{ .Date.Format "January 2, 2006" }}</p> <h3> <a href="{{ .Permalink | relURL }}"> {{- .Title -}} </a> </h3> - <p>Reading Time: {{ .ReadingTime }} minutes</p> + {{- partial "metadata" . -}} </div> {{ end }} </div> diff --git a/layouts/_default/single.html b/layouts/_default/single.html index bd08166..aae2433 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,9 +1,12 @@ {{ define "main" }} - -<h1 class="top-h1"> - {{- .Title -}} -</h1> -<div class="border p-2 rounded"> +<div class="rounded p-2 aafu-border border"> + <div class="border-bottom aafu-border"> + <h1 class="top-h1" style="font-size: 2.75em;"> + {{- .Title -}} + </h1> + {{- partial "metadata" . -}} + </div> {{ .Content }} </div> +{{ partial "prevnext" . }} {{ end }} diff --git a/layouts/index.html b/layouts/index.html index a69bfd6..c01e25b 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,6 @@ {{ define "main" }}
<div class="ml-auto mr-auto row row-eq-height rounded">
- <div class="col-md-5 text-center p-2 mt-3">
+ <div class="col-md-5 text-center p-2 mt-1">
<div class="profile-area rounded text-center position-relative shadow">
{{ partial "profilePhoto" . }}
<div class="p-2">
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index a28cc2a..e905eb6 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,4 +1,4 @@ -<footer class="mb-4">
+<footer class="{{ if .IsHome }} mt-2 mb-2 {{ else }} mt-2 mb-4 text-center {{ end }}">
<span class="markdownify">{{ .Site.Params.copyright | markdownify }}</span>
<span {{ if not .Site.Params.theme.showAttribute }}style="font-size:0px;"{{ end }}>
·
diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 8f37803..e46aaf5 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -19,62 +19,25 @@ rel="stylesheet"
href="//fonts.googleapis.com/css?family=Didact+Gothic%7CRoboto:400%7CRoboto+Mono"
/>
-
+ <link rel="stylesheet" href="{{ print "/css/aafu_" .Site.Params.theme.mainTheme ".css" | relURL }}" />
<link rel="stylesheet" href="{{ `/css/aafu.css` | relURL }}" />
<script>
- const colors = {
- light: {
- primaryBg: "#f8f9fa",
- primaryText: "black",
- primaryLinks: "#007bff",
- secondaryBg: "#fff",
- secondaryText: "black",
- secondaryLinks: "#007bff",
- shadow: "#595659"
- },
- dark: {
- primaryBg: "#2c2b2b",
- primaryText: "white",
- primaryLinks: "#ffc107",
- secondaryBg: "#373737",
- secondaryText: "white",
- secondaryLinks: "#ffc107",
- shadow: "black"
- },
- pinkish: {
- primaryBg: "#f8f9fa",
- primaryText: "black",
- primaryLinks: "#81415f",
- secondaryBg: "#81415f",
- secondaryText: "white",
- secondaryLinks: "#ffc107",
- shadow: "#595659"
- }
- };
- const mainTheme = {{ .Site.Params.theme.mainTheme }};
- let currentTheme = mainTheme;
- const altTheme = {{ .Site.Params.theme.altTheme }};
- const foo = (theme) => {
- let thisTheme = colors[theme];
- Object.keys(thisTheme).forEach(function(key) {
- document.documentElement.style.setProperty(`--${key}`, thisTheme[key]);
- });
- };
var themeColor = document.querySelector("meta[name=theme-color]");
- window.onload = function() {
- foo(currentTheme);
- const root = document.documentElement;
+ window.onload = () => {
themeColor.content = getComputedStyle(document.body)["background-color"];
- let defaultActivePanel = document.querySelector(".accordion.active")
- .nextElementSibling;
- defaultActivePanel.style.maxHeight =
- defaultActivePanel.scrollHeight + "px";
+ let defaultActivePanel = document.querySelector(".accordion.active");
+ if (defaultActivePanel) {
+ defaultActivePanel.nextElementSibling.style.maxHeight =
+ defaultActivePanel.nextElementSibling.scrollHeight + "px";
+ }
};
- window.onresize = function() {
- document.querySelector(".active").nextElementSibling.style.maxHeight =
- document.querySelector(".active").nextElementSibling.scrollHeight +
- "px";
+ window.onresize = () => {
+ let defaultActivePanel = document.querySelector(".accordion.active");
+ if (defaultActivePanel) {
+ defaultActivePanel.nextElementSibling.style.maxHeight =
+ defaultActivePanel.nextElementSibling.scrollHeight + "px";
+ }
};
</script>
</head>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 83361bd..2121ac8 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,5 +1,4 @@ -<div class="d-flex flex-row justify-content-between align-items-center mt-2"> -<div class="d-flex flex-row row"> +<div class="d-flex flex-row row p-2"> <h3 class="main-menu mr-3"> <a href="{{ .Site.BaseURL }}">Home</a> </h3> @@ -7,5 +6,3 @@ <a href="{{ "blog" | relURL }}">Blog</a> </h3> </div> -{{ partial "toggleTheme" . }} -</div>
\ No newline at end of file diff --git a/layouts/partials/metadata.html b/layouts/partials/metadata.html new file mode 100644 index 0000000..698a6e1 --- /dev/null +++ b/layouts/partials/metadata.html @@ -0,0 +1,18 @@ +<div class="mb-2"> + <p class="mb-1">{{ .Date.Format "January 2, 2006" }}</p> + {{ $params := .Params }} {{ range $name, $value := .Site.Taxonomies }} + {{ if index $params $name }} + <p class="metadata-value mb-1 taxa taxa-container-div list-{{- $name -}}"> + {{ $name | humanize }}: {{ range index $params $name }} + <a + class="pl-1 pr-1 rounded border border-secondary" + href="{{ $name | relURL }}/{{ . | urlize }}" + title="{{ $name }}" + > + {{- . -}} + </a> + {{ end }} + </p> + {{ end }} + {{ end }} +</div> diff --git a/layouts/partials/prevnext.html b/layouts/partials/prevnext.html new file mode 100644 index 0000000..d6974f4 --- /dev/null +++ b/layouts/partials/prevnext.html @@ -0,0 +1,26 @@ +<div class="d-flex flex-row justify-content-center"> + <h3 class="mb-1 mt-1 text-left mr-4"> + {{ if .PrevInSection }} + <a + href="{{ .PrevInSection.Permalink | relURL }}" + title="{{ .PrevInSection.Title }}" + > + <i class="nav-menu fas fa-chevron-circle-left"></i> + </a> + {{ else }} + <i class="nav-menu-disabled fas fa-chevron-circle-left"></i> + {{ end }} + </h3> + <h3 class="mb-1 mt-1 text-left ml-4"> + {{ if .NextInSection }} + <a + href="{{ .NextInSection.Permalink | relURL }}" + title="{{ .NextInSection.Title }}" + > + <i class="nav-menu fas fa-chevron-circle-right"></i> + </a> + {{ else }} + <i class="nav-menu-disabled fas fa-chevron-circle-right"></i> + {{ end }} + </h3> +</div> diff --git a/layouts/partials/toggleTheme.html b/layouts/partials/toggleTheme.html index eb437c2..e69de29 100644 --- a/layouts/partials/toggleTheme.html +++ b/layouts/partials/toggleTheme.html @@ -1,33 +0,0 @@ -{{ if .Site.Params.theme.allowToggle }} -<div class="toggleSwitchContainer" style="width: 45px; height: 45px;"> - <i - class="fas fa-toggle-on zoomlink" - id="toggle" - title="Toggle Theme" - onclick="toggleTheme(this)" - ></i> -</div> - -<script> - //const mainTheme = - // "{{ print (`/css/aafu_` | relURL) .Site.Params.theme.mainTheme `.css` }}"; - //const altTheme = - // "{{ print (`/css/aafu_` | relURL) .Site.Params.theme.altTheme `.css` }}"; - const currentCSS = document.querySelector("#color-CSS"); - function toggleTheme(elem) { - //console.log("." + mainTheme); - //console.log(altTheme); - elem.classList.toggle("fa-toggle-off"); - elem.classList.toggle("fa-toggle-on"); - currentTheme = currentTheme === mainTheme ? altTheme : mainTheme; - foo(currentTheme); - } - - function changeThemeColor() { - themeColor.content = getComputedStyle(document.body)["background-color"]; - } - const thisBody = document.body; - thisBody.addEventListener("webkitTransitionEnd", changeThemeColor); - thisBody.addEventListener("transitionend", changeThemeColor); -</script> -{{ end }} |