Browse Source

Add short code + add improve this page button

hossainemruz 4 years ago
parent
commit
9b10cadb58

+ 7 - 2
exampleSite/config.yaml

@@ -10,9 +10,14 @@ markup:
       unsafe: true
 
 # Enable Google Analytics
-# googleAnalytics: UA-12345
+googleAnalytics: UA-12345
 
 # Enable Disqus forum
-# disqusShortname: does-not-exist
+disqusShortname: does-not-exist
 
 # Enable global emoji support
+enableEmoji: true
+
+# Custom parameters
+params:
+  gitRepo: https://github.com/hossainemruz/toha-example-site

+ 10 - 2
layouts/_default/single.html

@@ -20,7 +20,7 @@
   <div class="page-content">
     <div class="author-profile ml-auto align-self-lg-center">
       <img class="rounded-circle" src='{{ partial "helpers/get-author-image.html" . }}'/>
-      <h5>{{ partial "helpers/get-author-name.html" . }}</h5>
+      <h5 class="author-name">{{ partial "helpers/get-author-name.html" . }}</h5>
       <p>{{ .Page.Date.Format "January 2, 2006" }}</p>
     </div>
 
@@ -32,7 +32,15 @@
       {{ .Page.Content }}
     </div>
 
-  <!---Next and Previous Navigator -->
+    <!--- Improve this page button --->
+    <div class="btn-improve-page">
+        <a href="{{ .Site.Params.GitRepo }}/edit/master/content/{{ .File.Path }}">
+          <i class="fas fa-code-branch"></i>
+          Improve This Page
+        </a>
+    </div>
+
+    <!---Next and Previous Navigator -->
   <hr />
   <div class="row next-prev-navigator">
     {{ $currentPage := . }}

+ 17 - 0
layouts/shortcodes/img.html

@@ -0,0 +1,17 @@
+<img src="{{ .Get "src"}}"
+    {{ if .Get "title"}}
+        alt="{{.Get "title"}}"
+    {{end}}
+    {{ if .Get "width"}}
+        width="{{.Get "width"}}"
+    {{end}}
+    {{ if .Get "height"}}
+        height="{{.Get "height"}}"
+    {{end}}
+    {{ if .Get "float"}}
+        style="float: {{.Get "float"}};"
+    {{end}}
+    {{ if .Get "align"}}
+        class="{{.Get "align"}}"
+    {{end}}
+>

+ 7 - 0
layouts/shortcodes/split.html

@@ -0,0 +1,7 @@
+<div class="row">
+    {{ range $idx, $val := split .Inner "---" }}
+       <div class="col col-sm-12 col-lg-{{ $.Get $idx }}">
+            {{ $val | markdownify }}
+        </div>
+    {{ end }}
+</div>

+ 1 - 0
layouts/shortcodes/vs.html

@@ -0,0 +1 @@
+<div style="margin-top: {{ .Get 0 }}rem;"></div>

+ 8 - 0
static/assets/css/single.css

@@ -31,6 +31,10 @@ body {
   text-align: center;
 }
 
+.author-name {
+  margin-top: 0px;
+}
+
 .author-profile img {
   height: 120px;
   width: 120px;
@@ -204,6 +208,10 @@ mark {
   padding: 10px;
 }
 
+.btn-improve-page{
+  text-align: right;
+}
+
 @media only screen and (max-width: 768px) {
   .wrapper {
     padding-left: 0px;

+ 16 - 0
static/assets/css/style.css

@@ -86,6 +86,22 @@ a:hover {
   padding-top: 3.5rem;
 }
 
+img.center{
+  display: block;
+  margin-left: auto;
+  margin-right: auto;
+}
+
+img.left{
+  display: block;
+  margin-right: auto;
+}
+
+img.right{
+  display: block;
+  margin-left: auto;
+}
+
 .card {
   box-shadow: none;
   transition: all 0.3s ease-out;