Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/asurbernardo/amperage.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsur <asur@asurbernardo.com>2020-10-14 22:19:36 +0300
committerGitHub <noreply@github.com>2020-10-14 22:19:36 +0300
commit00cce372aa97654b3adc34f733db31b963ecaa2d (patch)
tree94149589424666d03eb5160db4bc3fddadfd40db
parentc39572b67eaf078a3db5b0f01acbf0ce8dbbb6d9 (diff)
parent9a09b5cd59971cb018b010ecf1eab6b66fb64af0 (diff)
Release version 3.0
-rw-r--r--README.md35
-rw-r--r--assets/theme.scss113
-rw-r--r--data/amp-modules.json3
-rw-r--r--data/analytics-triggers.json6
-rw-r--r--data/auto-ads-config.json15
-rw-r--r--exampleSite/config.toml14
-rw-r--r--exampleSite/content/spanish/prueba/articulo-de-prueba.md4
-rw-r--r--exampleSite/content/spanish/prueba/otro-articulo-de-prueba.md4
-rw-r--r--exampleSite/content/test/emoji-support.md2
-rw-r--r--exampleSite/content/test/markdown-syntax.md2
-rw-r--r--exampleSite/content/test/placeholder-text.md2
-rw-r--r--exampleSite/content/test/yet-another-test-post.md4
-rw-r--r--i18n/en.toml4
-rw-r--r--i18n/es.toml4
-rw-r--r--images/lighthouse-results.pngbin31405 -> 0 bytes
-rw-r--r--images/screenshot.pngbin125618 -> 1175383 bytes
-rw-r--r--images/tn.pngbin55474 -> 482350 bytes
-rw-r--r--layouts/404.html2
-rw-r--r--layouts/_default/_markup/render-image.html46
-rw-r--r--layouts/_default/_markup/render-link.html9
-rw-r--r--layouts/_default/baseof.html4
-rw-r--r--layouts/index.json12
-rw-r--r--layouts/partials/blocks/image.html6
-rw-r--r--layouts/partials/head/amp-components.html10
-rw-r--r--layouts/partials/header/base.html5
-rw-r--r--layouts/partials/header/menu.html21
-rw-r--r--layouts/partials/header/search.html18
-rw-r--r--layouts/partials/page/analytics.html7
-rw-r--r--layouts/partials/page/auto-ads.html9
-rw-r--r--layouts/partials/page/infinite-scroll.html18
-rw-r--r--layouts/partials/post/comments.html2
-rw-r--r--layouts/partials/post/toc.html4
-rw-r--r--layouts/partials/shortcodes/amp-adsense.html19
-rw-r--r--static/icons/maskable-icon.pngbin0 -> 11742 bytes
-rw-r--r--static/manifest.json14
-rw-r--r--theme.toml10
36 files changed, 361 insertions, 67 deletions
diff --git a/README.md b/README.md
index 172e161..b8984d6 100644
--- a/README.md
+++ b/README.md
@@ -2,27 +2,23 @@
Amperage is a theme for static site generator [GoHugo](https://gohugo.io/). This theme provides the following features:
- - Generates AMP pages.
+ - Generates native AMP pages.
- Valid PWA out of the box.
- Automatic structured data.
- Service worker for asset caching, link prefetching and offline navigation.
- - SEO optimized.
+ - Made with SEO in mind.
- Multilanguage and i18n support.
- Code highlighting on build time.
- Super fast and lightweight.
- Minimal and easily overridable styles.
- - Basic AMP shortcodes for ease of use.
+ - Basic AMP shortcodes and markdown render hooks for ease of use.
- Header menu, table of contents and related posts.
- Uses web safe fonts by default.
- Automatic image croping and srcset generation.
- Social share buttons and OGP/Twitter card tags.
- - Google analytics with gtag.
+ - Customizable Google Analytics with gtag.
- Configurable Adsense shortcode.
- - Comment system agnostic.
-
-Lighthouse v5 theme results:
-
-![Lighthouse results](https://raw.githubusercontent.com/asurbernardo/amperage/master/images/lighthouse-results.png)
+ - Comment system agnostic ([Disqus example](https://github.com/asurbernardo/amperage-disqus-example)).
## ❯ Installation
@@ -43,7 +39,7 @@ hugo serve
## ❯ Kitchen sink
-You can check out all the components of this theme [here](https://asur.dev/en/amperage/theme-kitchen-sink) and a fully functional website using this theme [here](https://github.com/asurbernardo/blog).
+You can check out all the components of this theme [here](https://asur.dev/en/amperage/theme-kitchen-sink) and a fully functional website using Amperage [here](https://github.com/asurbernardo/blog) by yours truly.
## ❯ Configuration
@@ -56,7 +52,7 @@ theme = "amperage"
pygmentsUseClasses = true
# Number of posts shown per page
-paginate = 2
+paginate = 10
# Language sections
[languages]
@@ -122,6 +118,23 @@ paginate = 2
publisherLogo = "/logo-amp-article.png"
publisherLogoWidth = 600
publisherLogoHeight = 60
+
+# Generate json to use as search index
+[outputs]
+ home = [ "HTML", "RSS", "SearchIndex"]
+
+[outputFormats]
+ [outputFormats.SearchIndex]
+ mediaType= "application/json"
+ baseName= "search"
+ isPlainText= true
+ notAlternative= true
+
+# Enable unsafe mode to be able to use HTML on markdown
+[markup]
+ [markup.goldmark]
+ [markup.goldmark.renderer]
+ unsafe = true
```
## ❯ Customize logo
diff --git a/assets/theme.scss b/assets/theme.scss
index c08ad4a..b9093be 100644
--- a/assets/theme.scss
+++ b/assets/theme.scss
@@ -9,6 +9,10 @@ body {
color: black;
}
+amp-next-page {
+ grid-column: span 12;
+}
+
.header, .main, .footer {
grid-column: 4 / span 6;
}
@@ -19,8 +23,10 @@ body {
margin: 0;
padding: 0;
display: flex;
- overflow: auto;
+ flex-direction: row;
justify-content: flex-start;
+ align-items: center;
+ overflow: auto;
border: 1px solid #333;
a {
font-size: 1.2em;
@@ -50,6 +56,88 @@ body {
display: inline;
}
}
+ &__dropdown-input,
+ &__dropdown-label,
+ &__dropdown-list {
+ display: none;
+ }
+ &__dropdown-input:checked {
+ & ~ .header__menu__dropdown-list {
+ display: flex;
+ }
+ & ~ .header__menu__dropdown-label .header__menu__dropdown-icon {
+ background: transparent;
+ }
+ & ~ .header__menu__dropdown-label .header__menu__dropdown-icon:before {
+ top: 0;
+ transform: rotate(-45deg);
+ }
+ & ~ .header__menu__dropdown-label .header__menu__dropdown-icon:after {
+ top: 0;
+ transform: rotate(45deg);
+ }
+ }
+ &__dropdown-label {
+ cursor: pointer;
+ padding: 1em;
+ }
+ &__dropdown-icon {
+ background: #333;
+ display: block;
+ height: 2px;
+ position: relative;
+ transition: background .2s ease-out;
+ width: 36px;
+ &:before,
+ &:after {
+ background: #333;
+ content: '';
+ display: block;
+ height: 100%;
+ position: absolute;
+ transition: all .2s ease-out;
+ width: 100%;
+ }
+ &:before {
+ top: 15px;
+ }
+ &:after {
+ top: -15px;
+ }
+ }
+ &__dropdown-list {
+ width: 100%;
+ flex-direction: column;
+ align-items: center;
+ border-top: 1px solid #333;
+ li {
+ padding: .5em;
+ }
+ }
+ }
+ &__search {
+ font-family: Courier New, sans-serif;
+ color: black;
+ width: 100%;
+ margin: 0 auto 0 auto;
+ &__input {
+ padding: .5em 1em;
+ font-family: Courier New, sans-serif;
+ font-size: 1.2em;
+ width: 100%;
+ height: 75px;
+ border-radius: 0;
+ border: 1px solid black;
+ border-top: none;
+ &:focus {
+ outline: none;
+ }
+ }
+ .search-item {
+ &__link {
+ border-bottom: none;
+ }
+ }
}
}
@@ -67,6 +155,7 @@ body {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
+ margin-bottom: 1em;
}
h1 {
@@ -354,13 +443,32 @@ blockquote {
}
.main,
.footer {
- margin: 1em 0.75em 0 .5em;
+ margin: .5em .75em .5em .75em;
+ }
+ .footer {
+ flex-direction: column;
+ align-items: center;
+ margin-bottom: 1em;
}
.header {
margin: 0;
&__menu {
border: none;
border-bottom: 1px solid #333;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ &__list {
+ display: none;
+ }
+ &__dropdown-label {
+ display: block;
+ }
+ }
+ &__search {
+ &__input {
+ border: none;
+ border-bottom: 1px solid #333;
+ }
}
}
h1 {
@@ -395,7 +503,6 @@ blockquote {
&__caption {
position: relative;
max-width: 100%;
-
}
}
.product {
diff --git a/data/amp-modules.json b/data/amp-modules.json
index f621b54..3a8a884 100644
--- a/data/amp-modules.json
+++ b/data/amp-modules.json
@@ -51,5 +51,6 @@
"amp-vimeo" : "https://cdn.ampproject.org/v0/amp-vimeo-0.1.js",
"amp-vine" : "https://cdn.ampproject.org/v0/amp-vine-0.1.js",
"amp-viz-vega" : "https://cdn.ampproject.org/v0/amp-viz-vega-0.1.js",
- "amp-youtube" : "https://cdn.ampproject.org/v0/amp-youtube-0.1.js"
+ "amp-youtube" : "https://cdn.ampproject.org/v0/amp-youtube-0.1.js",
+ "amp-autocomplete" : "https://cdn.ampproject.org/v0/amp-autocomplete-0.1.js"
} \ No newline at end of file
diff --git a/data/analytics-triggers.json b/data/analytics-triggers.json
new file mode 100644
index 0000000..e430f46
--- /dev/null
+++ b/data/analytics-triggers.json
@@ -0,0 +1,6 @@
+{
+ "trackPageview": {
+ "on": "visible",
+ "request": "pageview"
+ }
+} \ No newline at end of file
diff --git a/data/auto-ads-config.json b/data/auto-ads-config.json
new file mode 100644
index 0000000..e966b2a
--- /dev/null
+++ b/data/auto-ads-config.json
@@ -0,0 +1,15 @@
+{
+ "placements": [
+ {
+ "anchor": {
+ "selector": "ARTICLE.content",
+ "sub": {
+ "selector": "P",
+ "all": true
+ }
+ },
+ "pos": 4,
+ "type": 1
+ }
+ ]
+} \ No newline at end of file
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 8b12ae6..3303eca 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -80,5 +80,17 @@ paginate = 3
publisherLogoWidth = 600
publisherLogoHeight = 60
+[outputs]
+ home = [ "HTML", "RSS", "SearchIndex"]
+
+[outputFormats]
+ [outputFormats.SearchIndex]
+ mediaType= "application/json"
+ baseName= "search"
+ isPlainText= true
+ notAlternative= true
+
[markup]
- defaultMarkdownHandler = "blackfriday" \ No newline at end of file
+ [markup.goldmark]
+ [markup.goldmark.renderer]
+ unsafe = true \ No newline at end of file
diff --git a/exampleSite/content/spanish/prueba/articulo-de-prueba.md b/exampleSite/content/spanish/prueba/articulo-de-prueba.md
index 08290b4..3ab5420 100644
--- a/exampleSite/content/spanish/prueba/articulo-de-prueba.md
+++ b/exampleSite/content/spanish/prueba/articulo-de-prueba.md
@@ -33,11 +33,11 @@ keywords = ['amperage', 'prueba', 'artículo']
# Otro artículo de prueba
-{{% under-title %}}
+{{< under-title >}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed laoreet, mauris sed tincidunt dignissim, enim justo suscipit dui, vitae pharetra justo nulla at neque. Ut eu nulla in nisi dapibus efficitur. Donec sollicitudin ac arcu ac malesuada. Cras sapien orci, malesuada id ultrices ac, sodales sed est. Integer orci diam, hendrerit sed tellus id, tempor semper enim. Donec enim nunc, rhoncus in tincidunt sed, dictum non risus. Proin scelerisque sit amet nulla a laoreet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ut fermentum justo. Duis viverra a dolor nec egestas. Fusce cursus vel nunc eu imperdiet. Nullam luctus felis magna, at feugiat dui ultrices nec. Etiam rutrum odio tellus, at molestie dui condimentum id. Maecenas feugiat dui consectetur ex pellentesque venenatis. In diam urna, hendrerit vitae est eu, laoreet rhoncus lectus. Nullam lorem tortor, commodo a purus dictum, vulputate pretium nisi.
-{{% toc %}}
+{{< toc >}}
## Primer título ✨
diff --git a/exampleSite/content/spanish/prueba/otro-articulo-de-prueba.md b/exampleSite/content/spanish/prueba/otro-articulo-de-prueba.md
index f130897..d18f76b 100644
--- a/exampleSite/content/spanish/prueba/otro-articulo-de-prueba.md
+++ b/exampleSite/content/spanish/prueba/otro-articulo-de-prueba.md
@@ -31,11 +31,11 @@ keywords = ['amperage', 'prueba', 'artículo']
# Otro artículo de prueba
-{{% under-title %}}
+{{< under-title >}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed laoreet, mauris sed tincidunt dignissim, enim justo suscipit dui, vitae pharetra justo nulla at neque. Ut eu nulla in nisi dapibus efficitur. Donec sollicitudin ac arcu ac malesuada. Cras sapien orci, malesuada id ultrices ac, sodales sed est. Integer orci diam, hendrerit sed tellus id, tempor semper enim. Donec enim nunc, rhoncus in tincidunt sed, dictum non risus. Proin scelerisque sit amet nulla a laoreet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ut fermentum justo. Duis viverra a dolor nec egestas. Fusce cursus vel nunc eu imperdiet. Nullam luctus felis magna, at feugiat dui ultrices nec. Etiam rutrum odio tellus, at molestie dui condimentum id. Maecenas feugiat dui consectetur ex pellentesque venenatis. In diam urna, hendrerit vitae est eu, laoreet rhoncus lectus. Nullam lorem tortor, commodo a purus dictum, vulputate pretium nisi.
-{{% toc %}}
+{{< toc >}}
## Primer título ✨
diff --git a/exampleSite/content/test/emoji-support.md b/exampleSite/content/test/emoji-support.md
index 5eb1c21..3fccd36 100644
--- a/exampleSite/content/test/emoji-support.md
+++ b/exampleSite/content/test/emoji-support.md
@@ -28,7 +28,7 @@ keywords = ['hugo', 'emoji', 'example']
# Emoji support
-{{% under-title %}}
+{{< under-title >}}
Emoji can be enabled in a Hugo project in a number of ways.
diff --git a/exampleSite/content/test/markdown-syntax.md b/exampleSite/content/test/markdown-syntax.md
index b73764c..528dbba 100644
--- a/exampleSite/content/test/markdown-syntax.md
+++ b/exampleSite/content/test/markdown-syntax.md
@@ -29,7 +29,7 @@ keywords = ['hugo', 'markdown', 'example']
# Markdown Syntax Guide
-{{% under-title %}}
+{{< under-title >}}
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.
diff --git a/exampleSite/content/test/placeholder-text.md b/exampleSite/content/test/placeholder-text.md
index 90cf088..866063f 100644
--- a/exampleSite/content/test/placeholder-text.md
+++ b/exampleSite/content/test/placeholder-text.md
@@ -29,7 +29,7 @@ keywords = ['hugo', 'placeholder', 'example']
# Placeholder Text
-{{% under-title %}}
+{{< under-title >}}
Lorem est tota propiore conpellat pectoribus de
pectora summo. Redit teque digerit hominumque toris verebor lumina non cervice
diff --git a/exampleSite/content/test/yet-another-test-post.md b/exampleSite/content/test/yet-another-test-post.md
index bc95104..41b6ac0 100644
--- a/exampleSite/content/test/yet-another-test-post.md
+++ b/exampleSite/content/test/yet-another-test-post.md
@@ -34,11 +34,11 @@ keywords = ['amperage', 'test', 'post']
# Yet another test post
-{{% under-title %}}
+{{< under-title >}}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed laoreet, mauris sed tincidunt dignissim, enim justo suscipit dui, vitae pharetra justo nulla at neque. Ut eu nulla in nisi dapibus efficitur. Donec sollicitudin ac arcu ac malesuada. Cras sapien orci, malesuada id ultrices ac, sodales sed est. Integer orci diam, hendrerit sed tellus id, tempor semper enim. Donec enim nunc, rhoncus in tincidunt sed, dictum non risus. Proin scelerisque sit amet nulla a laoreet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras ut fermentum justo. Duis viverra a dolor nec egestas. Fusce cursus vel nunc eu imperdiet. Nullam luctus felis magna, at feugiat dui ultrices nec. Etiam rutrum odio tellus, at molestie dui condimentum id. Maecenas feugiat dui consectetur ex pellentesque venenatis. In diam urna, hendrerit vitae est eu, laoreet rhoncus lectus. Nullam lorem tortor, commodo a purus dictum, vulputate pretium nisi.
-{{% toc %}}
+{{< toc >}}
## First title ✨
diff --git a/i18n/en.toml b/i18n/en.toml
index 434c486..86d0b67 100644
--- a/i18n/en.toml
+++ b/i18n/en.toml
@@ -2,8 +2,10 @@
other = "Home"
[notFound]
other = "Page not found"
+[openDropdown]
+other = "Open dropdown menu"
[search]
-other = "Search"
+other = "Search for a post..."
[goBackHome]
other = "Go back to the homepage"
[by]
diff --git a/i18n/es.toml b/i18n/es.toml
index c2d768b..2048f7e 100644
--- a/i18n/es.toml
+++ b/i18n/es.toml
@@ -2,8 +2,10 @@
other = "Inicio"
[notFound]
other = "Página no encontrada"
+[openDropdown]
+other = "Abrir menú desplegable"
[search]
-other = "Buscar"
+other = "Buscar un artículo..."
[goBackHome]
other = "Volver a la página de inicio"
[by]
diff --git a/images/lighthouse-results.png b/images/lighthouse-results.png
deleted file mode 100644
index b2f4b77..0000000
--- a/images/lighthouse-results.png
+++ /dev/null
Binary files differ
diff --git a/images/screenshot.png b/images/screenshot.png
index 23ebae9..26eed33 100644
--- a/images/screenshot.png
+++ b/images/screenshot.png
Binary files differ
diff --git a/images/tn.png b/images/tn.png
index 0ab995a..f9ed947 100644
--- a/images/tn.png
+++ b/images/tn.png
Binary files differ
diff --git a/layouts/404.html b/layouts/404.html
index 626e2c8..587902a 100644
--- a/layouts/404.html
+++ b/layouts/404.html
@@ -44,7 +44,7 @@
<main class="flex-container">
<h1 class="flex-item">{{ i18n "notFound"}}</h1>
<h1 class="flex-item"> 🏜️ </h1>
- <p class="flex-item"><a href="{{ .Site.BaseURL }}">{{ i18n "goBackHome" }}</a></p>
+ <p class="flex-item"><a href="{{ "/" | absLangURL }}">{{ i18n "goBackHome" }}</a></p>
</main>
</body>
</html>
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
new file mode 100644
index 0000000..3de31eb
--- /dev/null
+++ b/layouts/_default/_markup/render-image.html
@@ -0,0 +1,46 @@
+<figure class="figure {{ with .Title }}figure--with-caption{{ end }}">
+ {{ with .Title }}
+ <figcaption class="figure__caption">
+ {{- . -}}
+ </figcaption>
+ {{ end }}
+ {{ $resource := resources.Get .Destination }}
+ {{ with $resource }}
+ {{ if in (slice "jpeg" "jpg" "png") $resource.MediaType.SubType }}
+ <amp-img
+ src="{{ .Permalink | safeURL | absURL }}"
+ srcset="{{ (.Resize "1200x").Permalink }} 1200w,
+ {{ (.Resize "900x").Permalink }} 900w,
+ {{ (.Resize "800x").Permalink }} 800w,
+ {{ (.Resize "640x").Permalink }} 640w,
+ {{ (.Resize "480x").Permalink }} 480w,
+ {{ (.Resize "320x").Permalink }} 320w
+ "
+ width="{{ .Width }}"
+ height="{{ .Height }}"
+ layout="responsive"
+ alt="{{ $.Text }}"
+ {{ with $.Title}} title="{{ . }}"{{ end }}
+ class="figure__image {{ with $.Title }}figure__image--with-caption{{ end }}"></amp-img>
+ {{ else if in (slice "gif") $resource.MediaType.SubType }}
+ <amp-anim
+ src="{{ .Permalink | safeURL | absURL }}"
+ width="{{ .Width }}"
+ height="{{ .Height }}"
+ alt="{{ $.Text }}"
+ layout="responsive"
+ class="figure__image {{ with $.Title }}figure__image--with-caption{{ end }}"></amp-anim>
+ {{ else if in (slice "svg") $resource.MediaType.SubType }}
+ GoHugo resouces don't support svg images! ୧( ಠ Д ಠ )୨
+ {{ end }}
+ {{ else }}
+ <amp-img
+ src="{{ .Destination | safeURL | absURL }}"
+ height="1"
+ width="1"
+ layout="responsive"
+ alt="{{ .Text }}"
+ {{ with .Title}} title="{{ . }}"{{ end }}
+ class="figure__image {{ with .Title }}figure__image--with-caption{{ end }}"></amp-img>
+ {{ end }}
+</figure> \ No newline at end of file
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
new file mode 100644
index 0000000..1e76990
--- /dev/null
+++ b/layouts/_default/_markup/render-link.html
@@ -0,0 +1,9 @@
+{{ $baseUrl := trim .Page.Site.BaseURL "/" }}
+{{ $url := trim .Destination "/" | absURL }}
+
+<a href="{{ $url }}"
+ {{ if hasPrefix $url $baseUrl }} data-rel="prefetch"
+ {{else}} target="_blank" rel="nofollow noopener noreferrer" {{ end }}
+ {{ with .Title}} title="{{ . }}"{{ end }}>
+ {{- .Text | safeHTML -}}
+</a> \ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index dce6430..34a7d33 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -4,6 +4,7 @@
{{- partial "head/base.html" . -}}
</head>
<body>
+ {{- partial "page/auto-ads.html" . -}}
{{- partial "page/install-sw.html" . -}}
{{- partial "page/analytics.html" . -}}
{{- partial "structured-data/base.html" . -}}
@@ -16,5 +17,8 @@
<footer class="footer">
{{- partial "footer/base.html" . -}}
</footer>
+ {{ if .IsPage }}
+ {{- partial "page/infinite-scroll.html" . -}}
+ {{ end }}
</body>
</html>
diff --git a/layouts/index.json b/layouts/index.json
new file mode 100644
index 0000000..095575e
--- /dev/null
+++ b/layouts/index.json
@@ -0,0 +1,12 @@
+{ "items": [
+ {{- range $index, $page :=.Site.RegularPages -}}
+ {{- $months := index .Site.Data (i18n "months") -}}
+ {{- $month := index $months (printf "%d" .PublishDate.Month) -}}
+ {{- if ne $index 0 -}},{{- end -}}
+ {
+ "title": "{{ .Title }}",
+ "url": "{{ .Permalink }}",
+ "date": "{{ i18n "published" (dict "Day" .PublishDate.Day "Month" $month "Year" .PublishDate.Year) }}"
+ }
+ {{- end -}}
+]} \ No newline at end of file
diff --git a/layouts/partials/blocks/image.html b/layouts/partials/blocks/image.html
index c923e86..f3114cc 100644
--- a/layouts/partials/blocks/image.html
+++ b/layouts/partials/blocks/image.html
@@ -6,11 +6,11 @@
{{ end }}
{{ $resource := resources.Get .src }}
{{ with $resource }}
- {{ if and (eq .ResourceType "image") (ne .MediaType.SubType "svg") }}
+ {{ if in (slice "jpeg" "jpg" "png" "gif") $resource.MediaType.SubType }}
<amp-img
src="{{ .Permalink | absURL }}"
- srcset="
- {{ (.Resize "1200x").Permalink }} 1200w,
+ srcset="{{ (.Resize "1200x").Permalink }} 1200w,
+ {{ (.Resize "900x").Permalink }} 900w,
{{ (.Resize "800x").Permalink }} 800w,
{{ (.Resize "640x").Permalink }} 640w,
{{ (.Resize "480x").Permalink }} 480w,
diff --git a/layouts/partials/head/amp-components.html b/layouts/partials/head/amp-components.html
index 451ea45..a103c11 100644
--- a/layouts/partials/head/amp-components.html
+++ b/layouts/partials/head/amp-components.html
@@ -16,4 +16,14 @@
{{- end }}
{{ end }}
{{ end }}
+{{ end }}
+<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.2.js"></script>
+
+{{ with .Site.Params.AdsensePublisher }}
+ {{ if eq $.Site.Params.AutoAdsEnabled true }}
+ <script async custom-element="amp-auto-ads" src="https://cdn.ampproject.org/v0/amp-auto-ads-0.1.js"></script>
+ {{ end }}
+{{ end }}
+{{ if .IsPage }}
+ <script async custom-element="amp-next-page" src="https://cdn.ampproject.org/v0/amp-next-page-1.0.js"></script>
{{ end }} \ No newline at end of file
diff --git a/layouts/partials/header/base.html b/layouts/partials/header/base.html
index 1151e3e..1db2076 100644
--- a/layouts/partials/header/base.html
+++ b/layouts/partials/header/base.html
@@ -1,6 +1,7 @@
-<nav class="header__menu">
+<nav class="header__menu" next-page-hide>
<a class="header__menu__logo" data-rel="prefetch" href="{{ "" | absLangURL }}" aria-label="{{ i18n "goBackHome" }}">
{{- partial "header/logo.html" . -}}
</a>
{{- partial "header/menu.html" . -}}
-</nav> \ No newline at end of file
+</nav>
+{{- partial "header/search.html" . -}} \ No newline at end of file
diff --git a/layouts/partials/header/menu.html b/layouts/partials/header/menu.html
index 973ffca..174c05a 100644
--- a/layouts/partials/header/menu.html
+++ b/layouts/partials/header/menu.html
@@ -1,6 +1,23 @@
-
+{{ $baseUrl := trim .Site.BaseURL "/" }}
<ul class="header__menu__list">
- {{ $baseUrl := trim .Site.BaseURL "/" }}
+ {{ range .Site.Menus.main }}
+ {{ $url := trim .URL "/" | absURL }}
+ <li>
+ <a href="{{ $url }}"
+ {{ if or (.Page) (hasPrefix $url $baseUrl) }} data-rel="prefetch"
+ {{else}} target="_blank" rel="nofollow noopener noreferrer" {{ end }}>
+ {{ .Pre }}<span>{{ .Name }}</span>
+ </a>
+ </li>
+ {{ end }}
+</ul>
+
+<input class="header__menu__dropdown-input" type="checkbox" id="dropdown"/>
+<label class="header__menu__dropdown-label" for="dropdown" role="button" aria-label="{{ i18n "openDropdown"}}">
+ <span class="header__menu__dropdown-icon"></span>
+</label>
+
+<ul class="header__menu__dropdown-list">
{{ range .Site.Menus.main }}
{{ $url := trim .URL "/" | absURL }}
<li>
diff --git a/layouts/partials/header/search.html b/layouts/partials/header/search.html
new file mode 100644
index 0000000..55800eb
--- /dev/null
+++ b/layouts/partials/header/search.html
@@ -0,0 +1,18 @@
+<amp-autocomplete
+ on="select:AMP.navigateTo(url=event.value)"
+ filter="substring"
+ filter-value="title"
+ src="{{ `search.json` | absLangURL }}"
+ min-characters="1"
+ class="header__search"
+ next-page-hide>
+ <input class="header__search__input" type="text" placeholder="{{ i18n "search"}}" aria-label="{{ i18n "search"}}">
+ <template class="header__search__item-template" type="amp-mustache" id="amp-template-custom">
+ <div class="search-item" data-value="{{ `{{url}}` }}">
+ <small class="search-item__date">{{ `{{date}}` }}</small> <br>
+ <a class="search-item__link" {{ printf "href=%q" `{{url}}` | safeHTMLAttr }}>
+ {{ `{{title}}` }}
+ </a>
+ </div>
+ </template>
+</amp-autocomplete> \ No newline at end of file
diff --git a/layouts/partials/page/analytics.html b/layouts/partials/page/analytics.html
index 6f20775..7e166b8 100644
--- a/layouts/partials/page/analytics.html
+++ b/layouts/partials/page/analytics.html
@@ -8,12 +8,7 @@
"{{ $.Site.Params.googleAnalytics }}": { "groups": "default" }
}
},
- "triggers": {
- "trackPageview": {
- "on": "visible",
- "request": "pageview"
- }
- }
+ "triggers": {{ index $.Site.Data "analytics-triggers" }}
}
</script>
</amp-analytics>
diff --git a/layouts/partials/page/auto-ads.html b/layouts/partials/page/auto-ads.html
new file mode 100644
index 0000000..dbc575f
--- /dev/null
+++ b/layouts/partials/page/auto-ads.html
@@ -0,0 +1,9 @@
+{{ with .Site.Params.AdsensePublisher }}
+ {{ if eq $.Site.Params.AutoAdsEnabled true }}
+ <amp-auto-ads type="adsense" data-ad-client="{{ . }}">
+ <script type="application/json">
+ {{ index $.Site.Data "auto-ads-config" }}
+ </script>
+ </amp-auto-ads>
+ {{ end }}
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/page/infinite-scroll.html b/layouts/partials/page/infinite-scroll.html
new file mode 100644
index 0000000..cd9e09e
--- /dev/null
+++ b/layouts/partials/page/infinite-scroll.html
@@ -0,0 +1,18 @@
+{{ $related := .Site.RegularPages.Related . | first 3 }}
+
+{{ with $related }}
+<amp-next-page>
+ <script type="application/json">
+ [
+ {{- range $index, $post := . -}}
+ {{- if ne $index 0 -}},{{- end -}}
+ {
+ "image": "",
+ "title": "{{ .Title }}",
+ "url": "{{ .Permalink }}"
+ }
+ {{- end -}}
+ ]
+ </script>
+</amp-next-page>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/post/comments.html b/layouts/partials/post/comments.html
index 62c2559..c036b6e 100644
--- a/layouts/partials/post/comments.html
+++ b/layouts/partials/post/comments.html
@@ -1,4 +1,4 @@
-{{ if isset .Site.Params "commentsembedurl" }}
+{{ if and (isset $.Site.Params "commentsembedurl") (ne $.Page.Params.commentsDisabled true) }}
<amp-iframe width=600 height=180
layout="responsive"
sandbox="allow-scripts allow-same-origin allow-modals allow-popups allow-forms"
diff --git a/layouts/partials/post/toc.html b/layouts/partials/post/toc.html
index a181f02..20c2cd7 100644
--- a/layouts/partials/post/toc.html
+++ b/layouts/partials/post/toc.html
@@ -1,2 +1,4 @@
-<strong>{{ i18n "toc"}}:</strong>
+
+<p><strong>{{ i18n "toc"}}:</strong></p>
+
{{ .Page.TableOfContents }} \ No newline at end of file
diff --git a/layouts/partials/shortcodes/amp-adsense.html b/layouts/partials/shortcodes/amp-adsense.html
index dc1c817..bac6eef 100644
--- a/layouts/partials/shortcodes/amp-adsense.html
+++ b/layouts/partials/shortcodes/amp-adsense.html
@@ -9,24 +9,7 @@
{{ with .height }} height="{{ . }}"{{ end }}
{{ with .layout }} layout="{{ . }}"{{ end }}
{{ with .slot }} data-ad-slot="{{ . }}" {{ end }}
- data-ad-client="{{ $.Site.Params.adsensePublisher }}">
- <div class="ad__fallback" fallback><p>{{ i18n "noAd" }}</p></div>
- </amp-ad>
- </fieldset>
- {{ end }}
-{{ else }}
- {{ if isset . "context" }}
- {{ $publisher := .context.Site.Params.adsensePublisher }}
- <fieldset class="ad">
- <legend><strong>#ad</strong></legend>
- <amp-ad type="adsense"
- {{ with .class }} class="{{ . }}"{{ end }}
- {{ with .alt }} alt="{{ . }}"{{ end }}
- {{ with .width }} width="{{ . }}"{{ end }}
- {{ with .height }} height="{{ . }}"{{ end }}
- {{ with .layout }} layout="{{ . }}"{{ end }}
- {{ with .slot }} data-ad-slot="{{ . }}" {{ end }}
- data-ad-client="{{ $publisher }}">
+ data-ad-client="{{ $.Site.Params.AdsensePublisher }}">
<div class="ad__fallback" fallback><p>{{ i18n "noAd" }}</p></div>
</amp-ad>
</fieldset>
diff --git a/static/icons/maskable-icon.png b/static/icons/maskable-icon.png
new file mode 100644
index 0000000..cd8e7bb
--- /dev/null
+++ b/static/icons/maskable-icon.png
Binary files differ
diff --git a/static/manifest.json b/static/manifest.json
index c52fd59..fc41369 100644
--- a/static/manifest.json
+++ b/static/manifest.json
@@ -6,5 +6,17 @@
"background_color": "#fff",
"theme_color": "#333",
"description": "An example site for the Amperage theme.",
- "icons":[{"src":"/icons/android-chrome-192x192.png","sizes":"192x192","type":"image/png"}]
+ "icons":[
+ {
+ "src":"/icons/android-chrome-192x192.png",
+ "sizes":"192x192",
+ "type":"image/png"
+ },
+ {
+ "src": "/icons/maskable-icon.png",
+ "sizes": "196x196",
+ "type": "image/png",
+ "purpose": "any maskable"
+ }
+ ]
} \ No newline at end of file
diff --git a/theme.toml b/theme.toml
index 5a05918..960b224 100644
--- a/theme.toml
+++ b/theme.toml
@@ -3,18 +3,18 @@ name = "Amperage"
license = "MIT"
licenselink = "https://github.com/asurbernardo/amperage/blob/master/LICENSE"
-description = "Blazing fast SEO optimized theme with native AMP, structured data, service workers and i18n out of the box!"
+description = "Blazing fast SEO optimized theme with native AMP, structured data, search, service workers and i18n out of the box!"
homepage = "https://github.com/asurbernardo/amperage"
tags = ["blog", "personal", "responsive", 'minimal', 'clean', "simple", "google analytics", "light",
"multilingual", "syntax highlighting", "fast", "customizable", "minimalistic", "technical", "amp",
- "white", "disqus", "starter"]
+ "white", "disqus", "starter", "search"]
-features = ["amp", "seo", "pwa", "structured data", "toc", "related content", "service-worker", "shortcodes",
- "syntax highlighting", "tags", "social share"]
+features = ["amp", "seo", "pwa", "responsive", "structured data", "toc", "related content", "service-worker", "shortcodes",
+ "syntax highlighting", "tags", "social share", "search"]
-min_version = "0.60.0"
+min_version = "0.72.0"
[author]
name = "Asur Bernardo"