Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to combine mobile amp code and non-mobile code #759

Closed
miguelcolomer opened this issue Oct 26, 2015 · 2 comments
Closed

How to combine mobile amp code and non-mobile code #759

miguelcolomer opened this issue Oct 26, 2015 · 2 comments
Assignees

Comments

@miguelcolomer
Copy link

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.

@dvoytenko
Copy link
Contributor

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.

@dvoytenko dvoytenko self-assigned this Oct 27, 2015
@miguelcolomer
Copy link
Author

Ok, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants