tea3 / hexo-generator-amp

AMP ⚡ HTML (Accelerated Mobile Pages) generator for Hexo.
MIT License
127 stars 28 forks source link

fix permalink bug #36

Closed DamonHu closed 6 years ago

DamonHu commented 6 years ago

when the permalink like this

permalink: :category/:abbrlink.html

the permalink will Display as https://som.im/seo/65d1869b.htmlamp

tea3 commented 6 years ago

@DamonHu

I'm sorry, but that fix causes problems with current usage. I think you are using hexo-abbrlink. Is it possible to change permalink as follows?

permalink: :category/:abbrlink/

Then it will work normally with the current version.

Edit your theme (e.g. head.ejs)

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

Please consider changing permalink . Also If you can't change link , please use the project you forked.

DamonHu commented 6 years ago

Yes, I used that plug-in. In order to be more unified, I've changed the amp to the front

 <link rel="amphtml" href="<%= config.url %><%= config.root %>amp/<%= page.path %>index.html">

My submission is to solve the problem that the permalink is not a directory format. when you set the permalink end with the .html.

Because I think it's better to SEO, so I always add .html to the back and find that problem. Maybe I'm an disparate😂. And thank you for doing this

tea3 commented 6 years ago

@DamonHu

I'm sorry . I had forget Custom AMP HTML Path Function (generateAmpPath option). This request can solve by generateAmpPath option.

# Add this option in _config.yml.
generator_amp:
  generateAmpPath: amp/:category/:abbrlink.html

This option can use hexo-abbrlink's path. Please try it in current public version.

I think that extension does not affect SEO. It is more effective to create more articles than that you think to set the permalink end with the .html.