AMP专题-创建 AMP HTML 页面

以下标记是一个不错的起点或样板文件。 复制此标记,并将其保存为扩展名为 .html 的文件。

<!doctype html>
<html amp lang="en">
 <head>
 <meta charset="utf-8">
 <title>Hello, AMPs</title>
 <link rel="canonical" href="http://example.ampproject.org/article-metadata.html">
 <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
 <script type="application/ld+json">
 {
 "@context": "http://schema.org",
 "@type": "NewsArticle",
 "headline": "Open-source framework for publishing content",
 "datePublished": "2015-10-07T12:02:41Z",
 "image": [
 "logo.jpg"
 ]
 }
 </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>
 <script async src="https://cdn.ampproject.org/v0.js"></script>
 </head>
 <body>
 <h1>Welcome to the mobile web</h1>
 </body>
</html>

到目前为止,正文中的内容相当简单。但页面最前面有一些可能并非立即显而易见的额外代码。让我们解构一下所需的标记。

所需的标记

AMP HTML 文档必须:

以文档类型 <!doctype html> 开头
包含顶级 <html ⚡> 标记(也接受 <html amp>)
包含 <head> 和 <body> 标记(这些标记在 HTML 中是可选的)
在<head>内包含一个 <link rel="canonical" href="$SOME_URL"> 标记,该标记指向 AMP HTML 文档的常规 HTML 版本,或在此类 HTML 版本不存在的情况下指向文档本身
包含 <meta charset="utf-8"> 标记作为<head>标记的第一个子项
在<head>标记内包含 <meta name="viewport" content="width=device-width,minimum-scale=1"> 标记。还建议包括 initial-scale=1
包含 <script async src="https://cdn.ampproject.org/v0.js"></script> 标记作为<head>中的最后一个元素(这样做将会包括并加载 AMP JS 库)
在其 <head> 标记内包含以下内容: <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>

可选的元数据

除了纯粹的要求外,我们的示例还在<head>中包括了 Schema.org 定义,该定义不是对 AMP 的严格要求,但必须满足才能在某些地方(例如在 Google 搜索新闻轮播演示(请在您的手机上尝试))分发内容。

如需详细了解在各类其他地方(例如 Twitter)需要的所有元数据,请浏览我们的示例。如需具体了解 Google 搜索中的 AMP,请参阅 AMP 头条新闻。

这就是创建第一个 AMP 页面所需的全部内容,当然在正文中还有很多工作要做。在下一部分中,我们将介绍如何添加像图像、自定义 AMP 元素这样的基本内容,如何设置页面样式,以及如何实现响应式布局。

记一次Windows 2008+PHP+mysql环境配置搭建

目标主机环境:

Windows 2008 x64 R2

 

护卫神安装php+mysql

使用IIS7.5

IIS开启内容压缩,以及Rewrite伪静态插件。

首先刚做好系统,直接下载要使用的程序:

护卫神PHP套件PHP5.6版本:http://down.huweishen.com/free/phpwebFcgi56.zip

IIS7.5  Rewrite伪静态插件:http://download.microsoft.com/download/E/A/9/EA9F19BC-0EEB-49C9-B32D-56852BBE56DA/rewrite_amd64_zh-CN.msi

下载完成后我们直接打开压缩包安装,一路下一步即可。

 

护卫神安装
护卫神安装

护卫神安装完成之后他会自动将IIS一起安装。

IIS7.5
IIS7.5

我们那首先需要对IIS作的设置就是开启内容压缩。

打开服务器管理器-角色-web服务器-添加角色服务

我是已经提前安装完毕,所以这里是灰色的,未安装的直接选择上一路下一步即可。

动态内容压缩
动态内容压缩

安装完成后我们需要对内容压缩做一些设置

将默认的数值改为256,这样压缩率更高,更改后在右侧点击应用。

网页压缩设置
网页压缩设置

下面就是伪静态插件的安装。我们将下载来的伪静态插件打开一路下一步安装即可。

至此整个服务器环境基本配置完成。

2017年12月份促销信息月底截止

一、韩国机房年底狂欢让利

1,超低价:ATOM 2700/4G/500G/10M国际/5个IP 400元/月(该产品为预售,12月10日之前开始交付,限量50台)
2,大带宽:Xeon L5630*2/16G/1T/20M国际/5个IP 600元/月
3,高性能:Xeon E5-2650*2/32G/1T/20M国际/5个IP 900元/月(该产品为预售,12月10日之前开始交付,限量120台)
4,高防护:Xeon L5630*2/16G/1T/20M国际/5个IP/10G防护 999元/月
5,拼速度:Xeon L5630*2/16G/1T/10M CN2/5个IP/ 999元/月
二、电信北美 GIA 优质直连机型
Xeon E3-1230v4/16G/1T/5IP/1000M端口 GIA 直连 800元/月 限量200台 售完为止
默认提供1000M端口,若产生带宽滥用,则会限制到30M GIA 或100M 普通直连
 
三、香港 BGP CN2 性价比之王 6折体验继续进行
Xeon E5-2450L/32G/1T/10M/5个IP 900元/月 (加推80台,售完即止)
 
四、扬州电信 新品体验 首月低至5折
Xeon E5-2450L/32G/1T/20M/50G防护 半价体验 800元/月 (该产品为预售,12月10日之前开始交付,限量120台,售完即止)