正如标题所示,我试图将以下MasterPage.cshtml转换为AMP页面。我按照AMP指南进行操作,但是当我添加样板样式时,页面会出现解析错误。我已将错误添加为代码下方的屏幕截图。我在网上发现的所有指南都说明AMP的代码必须没有我已经完成的空白区域。我有点不知道为什么它会在样式属性中的样式规则上抛出错误。
Umbraco v6.1.6
<title>@ViewBag.MetaPageTitle</title>
<meta name="viewport" content="width=device-width,minimum-scale=1">
<meta property="og:type" content="website" />
<meta property="og:image" content="@hostURL/Images/fb-share-icon.jpg" />
<meta name="description" content="@ViewBag.MetaDescription">
<meta name="keywords" content="@ViewBag.MetaKeywords">
<meta property="og:title" content="@ViewBag.OpenGraphTitle" />
<meta property="og:description" content="@ViewBag.OpenGraphDescription" />
<link rel="shortcut icon" href="@hostURL/favicon.ico">
<!-- <link rel="stylesheet" href="//f.fontdeck.com/s/css/dHB7e0dw8S61Pb8GIfIJeoCm92Q/@simpleHostURL/43285.css" type="text/css" /> -->
@Html.Raw(@Html.RenderCssHere())
<!-- Umbraco Rich Text Editior Styles -->
<link rel="stylesheet" href="css/textStyles.css" type="text/css" />
<!--[if gt IE 8]><!-->
<link rel="stylesheet" href="css/hover.css" type="text/css" />
<!--<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" href="css/ie8.css">
<script src="~/scripts/respond.min.js"></script>
<script src="~/scripts/fontello.ie8.fix.js"></script>
<![endif]-->
@Umbraco.RenderMacro("CanonicalUrl")
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-carousel" src="https://cdn.ampproject.org/v0/amp-carousel-0.1.js"></script>
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<!-- Google Tag Manager -->
<noscript>
<iframe src="//www.googletagmanager.com/ns.html?id=GTM-KJSQSJ" height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src =
'//www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-KJSQSJ');
</script>
<!-- End Google Tag Manager -->
<div class="page-wrap">
<!--HEADER START-->
<div class="header full-width">
<div class="header max-width">
<div id="menu">
<a href="#" id="menu-icon" class="icon-menu"></a>
</div>
<div class="logo-heading">
<a href="/">
<img src="Images/nicabate-logo.png" alt="Nicabate">
</a>
</div>
<div class="nav main-nav">
<ul>
<li class="nav-links">
<a href="~/products.aspx" @Html.Raw(productsActive)>PRODUCTS</a>
<ul class="sub-menu">
<li>
<a href="/product-selector.aspx">Product Selector</a>
</li>
<li>
<a href="/discover-the-different-ways-to-quit-smoking.aspx">Ways to quit smoking</a>
</li>
<li>
<a href="/nicabate-patches.aspx">Patches</a>
</li>
<li>
<a href="/nicabate-extra-fresh-mint-gum.aspx">Gum</a>
</li>
<!--<li><a href="https://www.nicabate.com.au/nicabate-oral-strips.aspx">Oral Strips</a></li>-->
<li>
<a href="/nicabate-minis.aspx">Minis</a>
</li>
<li>
<a href="/nicabate-combo-therapy.aspx">Combo therapy</a>
</li>
<li>
<a href="/where-to-buy.aspx">Where to buy</a>
</li>
</ul>
</li>
<li class="nav-links">
<a href="~/wanting-to-quit.aspx" @Html.Raw(iWantToQuitActive)>WANTING TO QUIT</a>
<ul class="sub-menu">
<li>
<a href="/how-come-youre-hooked.aspx">How come you're hooked?</a>
</li>
<li>
<a href="/tips-that-can-help-you-quit.aspx">Tips that can help you quit</a>
</li>
<li>
<a href="/managing-the-five-withdrawal-symptoms.aspx">Managing the five withdrawal symptoms</a>
</li>
<li>
<a href="/how-nicotine-replacement-can-help.aspx">How nicotine replacement can help</a>
</li>
<li>
<a href="/ways-youll-become-more-healthy.aspx">Ways you will become more healthy</a>
</li>
<li>
<a href="/how-youll-become-better-off-financially.aspx">How you will become better off financially</a>
</li>
<li>
<a href="/smoke-free-during-pregnancy.aspx">Smoke free during pregnancy</a>
</li>
<li>
<a href="/whats-so-hard-about-quitting.aspx">What is so hard about quitting?</a>
</li>
</ul>
</li>
<li class="nav-links">
<a href="~/want-to-stay-quit.aspx" @Html.Raw(staySmokeFreeActive)>WANT TO STAY QUIT</a>
<ul class="sub-menu">
<li>
<a href="/commit-yourself-to-quitting.aspx">Commit yourself to quitting</a>
</li>
<li>
<a href="/get-support-for-quitting.aspx">Get support for quitting</a>
</li>
<li>
<a href="/tips-for-managing-nicotine-withdrawal.aspx">Tips for managing nicotine withdrawal</a>
</li>
<li>
<a href="/discover-what-to-expect-when-youre-quitting.aspx">Discover what to expect when you're quitting</a>
</li>
<li>
<a href="/how-to-handle-occasional-slip-ups.aspx">How to handle occasional slip ups</a>
</li>
</ul>
</li>
<li class="nav-links">
<a href="~/support.aspx" @Html.Raw(toolsActive)>SUPPORT</a>
<ul class="sub-menu">
<!--<li><a href="/game-to-quit.aspx">Download our App</a></li>-->
<li>
<a href="https://www.facebook.com/pledgetoquitsmoking">Support Community</a>
</li>
</ul>
</li>
<li class="nav-links last">
<a href="/where-to-buy.aspx">WHERE TO BUY</a>
</li>
<li class="facebook-join main-facebook">
<a href="https://www.facebook.com/pledgetoquitsmoking" target="_blank">Join us on</a>
</li>
</ul>
</div>
<div class="facebook-join main-facebook">
<a href="https://www.facebook.com/pledgetoquitsmoking" onClick="ga('send', 'event', { eventCategory: 'Facebook ', eventAction: 'Join Community', eventLabel: 'Top Nav'});"
target="_blank">
<span>Support Community</span>
</a>
</div>
<div class="search-icon">
<a id="search-icon" href="#" class="icon-search"></a>
</div>
<div class="search">
@Html.Action("Index", "SearchSurface")
</div>
</div>
<div class="clear"></div>
</div>
<!--HEADER END-->
<!--CONTENT START-->
@RenderBody()
<!--CONTENT END-->
</div>
<!--FOOTER START-->
<div class="footer full-width">
<div class="footer max-width">
<div class="extra-footer">
<div class="footer-col">
<strong>
<a href="/products.aspx">Nicabate Products</a>
</strong>
<ul>
<li>
<a href="/product-selector.aspx">Product Selector</a>
</li>
<li>
<a href="/discover-the-different-ways-to-quit-smoking.aspx">Ways to quit smoking</a>
</li>
<li>
<a href="/nicabate-patches.aspx">Nicotine Patches</a>
</li>
<li>
<a href="/nicabate-extra-fresh-mint-gum.aspx">Gum</a>
</li>
<li>
<a href="/nicabate-minis.aspx">Minis</a>
</li>
<li>
<a href="/nicabate-combo-therapy.aspx">Combo therapy</a>
</li>
<li>
<a href="/where-to-buy.aspx">Where to Buy</a>
</li>
</ul>
</div>
<div class="footer-col">
<strong>
<a href="/i-want-to-quit.aspx">Wanting to Quit</strong>
<ul>
<li>
<a href="/how-come-youre-hooked.aspx">How come you're hooked?</a>
</li>
<li>
<a href="/tips-that-can-help-you-quit.aspx">Tips that can help you quit</a>
</li>
<li>
<a href="/managing-the-five-withdrawal-symptoms.aspx">Managing the five withdrawal symptoms</a>
</li>
<li>
<a href="/how-nicotine-replacement-can-help.aspx">How nicotine replacement can help</a>
</li>
<li>
<a href="/ways-youll-become-more-healthy.aspx">Ways you will become more healthy</a>
</li>
<li>
<a href="/how-youll-become-better-off-financially.aspx">How you will become better off financially</a>
</li>
<li>
<a href="/smoke-free-during-pregnancy.aspx">Smoke free during pregnancy</a>
</li>
<li>
<a href="/whats-so-hard-about-quitting.aspx">What is so hard about quitting?</a>
</li>
</ul>
</div>
<div class="footer-col">
<strong>
<a href="/stay-smoke-free.aspx">Want to stay Quit</a>
</strong>
<ul>
<li>
<a href="/commit-yourself-to-quitting.aspx">Commit yourself to quitting</a>
</li>
<li>
<a href="/get-support-for-quitting.aspx">Get support for quitting</a>
</li>
<li>
<a href="/tips-for-managing-nicotine-withdrawal.aspx">Tips for managing nicotine withdrawal</a>
</li>
<li>
<a href="/discover-what-to-expect-when-youre-quitting.aspx">Discover what to expect when you're quitting</a>
</li>
<li>
<a href="/how-to-handle-occasional-slip-ups.aspx">How to handle occasional slip ups</a>
</li>
</ul>
</div>
<div class="footer-col">
<strong>About this Website</strong>
<ul>
<li>
<a href="/contact-us.aspx">Contact Us</a>
</li>
<li>
<a href="/faq-page.aspx">Frequently Asked Questions</a>
</li>
<li>
<a href="/site-map.aspx">Site Map</a>
</li>
<li>
<a href="/privacy-policy.aspx">Privacy Policy</a>
</li>
<li>
<a href="/terms-of-use.aspx">Terms of Use</a>
</li>
<li>
<a href="https://www.facebook.com/pledgetoquitsmoking">Join us on Facebook</a>
</li>
</ul>
</div>
</div>
<div id="footer-gsk">
<div id="footer-gsk-logo">
<img src="Images/gsk-logo.png" alt="gsk" />
</div>
<div id="footer-gsk-copy">
<p>Stop smoking aid. Contains nicotine. Use only as directed. Always read the label.</p>
<p>NICABATE, PLEDGE TO QUIT and the hand logo are registered trade marks of the GlaxoSmithKline group of companies.</p>
<p>© 2015 GlaxoSmithKline Australia Pty Ltd - All Rights Reserved</p>
</div>
</div>
@if(CurrentPage.DocumentTypeAlias == "Home") {
<div id="a1">
<p>The smoking facts are clear – the longer you continue smoking, the more damage you’re doing to your health and the health
of the people around you. Quit smoking and you’ll begin healing your body immediately. Make no mistake about it – quitting
smoking isn’t easy. It’s a journey of ups and downs, little wins and tempting cravings that threaten to crush your willpower
and all your positive progress. Quitting smoking for good requires persistence, motivation and willpower.</p>
<p>Along the journey to successfully quitting smoking, you’ll need all the support you can get and that’s where Nicabate
can help with a range of nicotine quit smoking products. Take your mind off the cravings with Nicabate Mint Gum. Tackle
the toughest cravings when they occur with Nicabate Lozenges. Relieve smoking impulses in minutes with Nicabate Mini
Mints. Make mornings less stressful and control cravings around the clock with Nicabate Nicotine Patches. If you’re
building up to quitting smoking on a certain date, prepare yourself to quit cold turkey with Nicabate Pre-Quit Patches.</p>
<p>Start enjoying the extensive health, lifestyle and financial benefits of quitting smoking. The Nicabate product range
combined with the assistance of a support network will help you quit smoking for good.</p>
</div>
}
</div>
</div>
<!--FOOTER END-->
@Html.Raw(@Html.RenderJsHere()) @if(CurrentPage.DocumentTypeAlias == "Home") {
<script>
$(window).ready(function () {
$('#a1').hide();
});
$(window).load(function () {
$('#a1').hide();
});
</script>
}
<script>
$(document).ready(function () {
$("#mailShareIcon").click(function () {
var currentUrl = window.location.href;
window.location.href = "mailto:?subject=GSK - What type of smoker are you?&body=" + currentUrl;
});
});
</script>
我从Umbraco来的错误
答案 0 :(得分:2)
@启动一个代码块,因此您需要在AMP样式中转义@。我相信你可以在他们面前放另一个@(所以@@ - webkit-whatever)。