(eleventy) How to generate rel="amphtml" formats for src *.md file

101 views Asked by At

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?

0

There are 0 answers