How to combine mobile amp code and non-mobile code
In Blogger 's template (like the "CMS" that i'm using) i can use sentences to write the HTML for mobiles different than for the standard desktop pc (it's like xhtml or something ). Using sentences like "if cond mobile" all the following code only executes in mobiles and the other code outside of the "}" applies only for desktop pc.
So if i use the "if cond" for mobiles and i write an amp-ad with adsense code, and the "old" adsense code (not "amped" and for desktop pc)... can i have problems with adsense policy or something?.
Is it a "best practice" to separate the amp code for mobiles ftom the standard HTML for desktop PCs?.
Thank you very much.
This is definitely up to you. But there's a number of ways AMP can help you and we definitely recommend creating fully-responsive documents in AMP.
To start with all AMP elements support media attribute that follow @media CSS syntax and control whether or not the element is displayed in a particular scenario. See the https://github.com/ampproject/amphtml/blob/master/spec/amp-html-layout.md#media for some examples.
Then, we also support sizes attribute (described in the same document) that allows configuration for different media conditions - just as the case with sizes attribute for a standard img tag.
Finally, you are free to use @media CSS conditions. A nice thing about AMP is that elements take virtually no memory or CPU resources unless they are actually visible. This way you can safely do amp-ad elements for different scenarios and only those visible will be activated, downloaded, constructed, etc.
Ok, thank you very much!