AMP-theme
build
europe-west1-docker.pkg.dev/pkg-fuww/fu/amp-theme:latest
docker build . -t europe-west1-docker.pkg.dev/pkg-fuww/fu/amp-theme:latest
docker run -t europe-west1-docker.pkg.dev/pkg-fuww/fu/amp-theme:latest bash
docker run -it \
-v /tmp/config.json:/kaniko/.docker/config.json \
-v $(pwd):/build \
gcr.io/kaniko-project/executor:debug \
--cache=true \
--dockerfile /Dockerfile \
--destination someimage
Original theme documentation - gohugo-amp
⚡ AMP starter theme for gohugo https://gohugo-amp.gohugohq.com
This Hugo theme is supposed to be a starter theme to make it easy to adapt to Google's AMP-Project. Included in the theme are 40+ shortcodes and partials and automatic Structured Data making it a pleasure to embed AMP-Elements within your content files or your template.
Installation
Go to the directory where you have your Hugo site and run:
$ mkdir themes
$ cd themes
$ git clone https://github.com/wildhaber/gohugo-amp.git
$ rm -rf gohugo-amp/.git
An extended theme documentation at gohugo-amp.gohugohq.com. For more information about the theme installation read the official setup guide of Hugo.
Configuration
After installing the theme successfully, we recommend you to take a look at the Kitchen Sink. You find extensive documentation and a demonstration of all shortcodes and partials there.
For some features, you need to add configuration to your base config.toml
params section:
[params]
images = ["/landing/theme/images/fu-default_1200x630_black-favicon.jpg"]
amp = true
ampCdnRoot = "https://cdn.ampproject.org/"
ampRelease = "v0"
ampElementsVersion = "0.1"
ampElements = ["amp-sidebar","amp-analytics", "amp-ad"]
themeColor = "#FFFFFF"
adsensePublisher = "pub-7763170145936962"
alternatePageName = "FashionUnited AMP"
organizationLogo = "https://fashionunited.com/global-assets/fu20164/dist/images/schema-org/logo-600x51.png"
organizationName = "fashionunited.com"
organizationAddress = "Hoogoorddreef 56S, 1101BE Amsterdam"
publisherName = "FashionUnited"
publisherLogo = "https://fashionunited.com/global-assets/fu20164/dist/images/schema-org/logo-600x51.png"
publisherLogoWidth = 600
publisherLogoHeight = 51
amp = true
ampElements = ["amp-accordion","amp-ad","amp-analytics","amp-carousel","amp-iframe","amp-app-banner","amp-dynamic-css-classes","amp-form","amp-fx-flying-carpet","amp-image-lightbox","amp-lightbox","amp-sidebar","amp-social-share","amp-sticky-ad","amp-user-notification"]
themeColor = "#112233"
adsensePublisher = "ca-pub-123456789"
googleAnalytics = "UA-123456-78"
appleItunesApp = "app-id=123456789, app-argument=app-name://link/to/app-content"
ampManifest = "/amp-manifest.json"
alternatePageName = "HUGO AMP"
organisationLogo = "https://gohugohq.com/logo.png"
organisationName = "gohugohq.com"
organisationAddress = "Some Street 123, 12345 City"
socialProfiles = ["http://www.facebook.com/your-profile","http://instagram.com/yourProfile","http://www.linkedin.com/in/yourprofile","http://plus.google.com/your_profile"]
publisherName = "gohugohq.com"
publisherLogo = "https://gohugo-amp.gohugohq.com/logo-publisher.png"
publisherLogoWidth = 600
publisherLogoHeight = 60
stylesheetRegular = ["/base-styling.css"]
javascriptRegular = ["/script.js"]
Sources for AMP references are managed in the data/amp-modules.json-File.
Styling
AMP does not allow you to include CSS styles with the regular link rel='stylesheet'
-tag we need to embed the CSS in the header section.
For this case add a file in your regular layouts/partials/
-folder called stylesheet.html
. In this file you can write pure CSS (no <styles>
-Tags required)
Since its not a cool idea have to write your stylesheets in an HTML-File we provide an automated process rendering your Sass output directly in this file. You can read more in our Guide about Styling in the documentation.
Google Analytics
Beside of adding the googleAnalytics in your base config.toml
you also need to define triggers. Simply add a file in your base data section /data/analytics/triggers.json
. For example:
{
"trackPageview": {
"on": "visible",
"request": "pageview"
},
"trackEvent" : {
"selector": "body",
"on": "click",
"request": "event",
"vars": {
"eventCategory": "body-click",
"eventAction": "click"
}
}
}
Further information about AMP Analytics you will find in the official documentation of the amp-project.
App-Banners
App-Banners are very popular and help you to win your regular website's visitor downloading your app. Simply add a file in your base data section /data/app/banner.json
for the configuration to display it in a mobile browser:
{
"id" : "app-banner-id",
"src" : "https://placehold.it/60x51/ff3300/cccccc",
"name" : "My Apps Name",
"description" : "Short app description. Really short.",
"openText" : "get the app"
}
Further information about AMP App-Banners you will find in the official documentation of the amp-project.
Demo and Example
A demonstration of the theme can be found at gohugo-amp.gohugohq.com and an example integration you will find here:
wildhaber/gohugo-amp.gohugohq.com
Contributing
Have you found a bug or got an idea for a new feature? Feel free to use the issue tracker to let me know. Alternatively, make a pull request directly.
License
gohugo-amp released under the MIT License.
Thanks
Thanks to Steve Francia for creating Hugo and the awesome community around the project.
Known bugs
Error: ENOENT: no such file or directory, scandir '**/node_modules/node-sass/vendor'
https://github.com/sass/node-sass/issues/1579
npm update
npm install
nodejs node_modules/node-sass/scripts/install.js
npm rebuild node-sass