Search code examples
amp-html

AMP and code blocks


I have a web about programming and it has some articles with code blocks. Now Google Webmaster tools reports me that I have some issues with my AMP implementation.

I have searched a bit and I think that the problem is the usage of code blocks like this:

<pre lang="c">
#include <stdlib.h>
#include <stdio.h>
#include <gmp.h>
...
</pre>

AMP tools analyze this code and report me some issues, for example:

The tag "stdio.h" isn't allowed

The tag "stdlib.h" isn't allowed

I have read the AMP documentation and I haven't found any solution, so do you know how to fix it?

PD: Post the code as image isn't a valid solution for mine.


Solution

  • You need to escape '<' and '>' in your source code

    <pre lang="c">
    #include &lt;stdlib.h&gt;
    #include &lt;stdio.h&gt;
    #include &lt;gmp.h&gt;
    ...
    </pre>