tea3 / hexo-generator-amp

AMP ⚡ HTML (Accelerated Mobile Pages) generator for Hexo.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to use this plugin with "jade" based templates?

pr4bh4sh opened this issue · comments

I'm using https://github.com/tufu9441/maupassant-hexo for a template. Can you convert below to jade equivalent.

  <% if (is_post() && config.generator_amp){ %>
    <link rel="amphtml" href="./amp/index.html">
  <% } %>
commented

Hi, @pr4bh4sh .
Please edit themes/maupassant/layout/base.jade.

html(lang='#{config.language}')
  head
    //- Please place the following code.
    if is_post() && config.generator_amp
      link(rel="amphtml", href='./amp/index.html')

It worked.
however, the content its generating seems messed up.

screen shot 2016-11-02 at 4 46 31 pm

I was expecting something like ./:title/amp and it is generating ./:title/amp
My understanding from the current output is, it generates amp pages along with the normal pages and with the help of your plugin whenever google sees rel="amphtml" it show the url of the amp page.
Am I missing something in configurations?
My configuration file's contents

theme: maupassant

generator_amp:
  templateDir: amp #template which generate amp tags
  assetDistDir: amp-dist #assests of the template
  logo:
    path:   sample/sample-logo.png
    width:  600
    height: 60
  substituteTitleImage:
    path:   sample/sample-substituteTitleImage.png
    width:  1024
    height: 800
  warningLog: false

Update: I fixed it, just added / after the permalink
permalink: :title to permalink: :title/