0

I am trying to find a solution for generating an AMP version for particular pages in my 11ty (Eleventy) website.

Take for example the following content ...

|
+- /src
    |
    +- /recipes
        |
        +- super-stroodle.md

Ideally I would like to see the following generated ...

|
+- /_site
    |
    +- /recipes
        |
        +- super-stroodle
            |
            +- index.html
            |
            +- amp.html <-- Same content but different layout

In the index.html file I would see the following in the header ...

<head>
    <link rel="canonical" href="https://example.com/recipes/super-stroodle">
    <link rel="amphtml" href="https://example.com/recipes/super-stroodle/amp">
</head>

I'm not tied to this outcome, but I do need some way to apply alternate layouts to select source content.

Any ideas how to achieve this with 11ty?

ra9r
  • 4,528
  • 4
  • 42
  • 52
  • What luck have you had with this: https://blog.amp.dev/2020/07/28/introducing-the-eleventy-amp-plugin/ – Jay Gray Sep 01 '20 at 17:11
  • The AMP plugin for 11ty only provides support for what would go into the templates ... which isn't the problem I have. Their plugin would work great as long as for each *.md file all I needed was an AMP page as the canonical page. This not what I need. I need both a canonical HTML page as well as a `` version. @JayGray – ra9r Sep 01 '20 at 19:27
  • My current approach is to look at using a combination of 11ty collections and pagination to create a data source that is essentially a list of the pages I want to convert to AMP and use pagination to connect each to an AMP optimized template for them. I know this will work for data ... and it will also work for data with simple markdown ... but I'm not sure what will happen if the markdown also needs to be processed by nujucks or liquid. – ra9r Sep 01 '20 at 19:30

0 Answers0