diff --git a/source/doc/story/create1.md b/source/doc/story/create1.md new file mode 100644 index 0000000..d6e6b4d --- /dev/null +++ b/source/doc/story/create1.md @@ -0,0 +1,82 @@ +title: 创建小故事-小故事的概念 +layout: doc +--- + +## 小故事的概念 + +### 小故事是什么 + +​ 小故事是一种可交互的多媒体卡片,是由多元化内容组成的媒体形态,可带来沉浸式、多媒体、可交互的浏览体验,如图,是一个小故事的示例; + +- 示例 + + + +### 小故事产品构成 + +​ 每个小故事(Story)下有多个段落(View),每个段落(View)可自由组合音频、视频、图片、GIF、文字等富媒体元素(Element)。 + + + + + +### 小故事面向人群 + +​ 小故事采用开放的[MIP技术](https://www.mipengine.org/),能让站长、自媒体、开发者、商家等各种可以提供优质有创意内容的人群使用工具或MIP技术进行小故事创作。 + +​ 在百度搜索结果页的呈现形式如图: + +![搜索结果页展示](http://mipstatic.baidu.com/static/mip-static/mip-story/demo/static/%E6%90%9C%E7%B4%A2%E7%BB%93%E6%9E%9C%E9%A1%B5%E5%B1%95%E7%A4%BA.png) + +## 起步教程 + +### 1. 技术储备 + +开发一个小故事的技术储备: + +1. HTML,CSS和JavaScript的基本知识; +2. 对MIP的基础原理和规范,请参考[MIP 的开发文档](https://www.mipengine.org/doc/00-mip-101.html) ; + +### 2、开发环境准备,Run起示例Demo + +1、下载代码; + +- 下载本教程的代码,下载地址如下:[oscar-demo](http://mipstatic.baidu.com/static/mip-static/mip-story/demo/story-demo.zip); +- 提取zip文件的内容,减压后在story-demo目录下的oscar-story.html是完整小故事demo的入口。 + +2、运行示例页面 + +​ 运行示例代码的方法如同启动MIP页面的服务,MIP 页文件可以直接运行,你可以选择如下方式,像预览普通 HTML 站点一样预览 MIP-HTML 页面: + +- 直接在浏览器中打开(由于 XML HTTP Requests 失败可能会导致某些元素预览失败)。 +- 在本地部署一个服务,如 Apache,Nginx 等。 + 使用 MIP-CLI 辅助预览,使用方法见 MIP 博客:[开发教程一](http://www.cnblogs.com/mipengine/p/mip_cli_1_install.html)。 + +设置完本地的web服务,通过访问一下URL,可查看小故事的Demo示例: + +``` +http://localhost:8000/oscar-story.html +``` + +完成了以上准备工作,那么接下来,让我们开始开发属于你自己的小故事。 + + +## 我的标签 + +[第一篇、开发小故事前期准备](https://www.mipengine.org/doc/story/create1.html) + +[第二篇、小故事的组织结构](https://www.mipengine.org/doc/story/create2.html) + +[第三篇、创建小故事的封面](https://www.mipengine.org/doc/story/create3.html) + +[第四篇、开发更丰富的小故事段落](https://www.mipengine.org/doc/story/create4.html) + +[第五篇、小故事内置动画](https://www.mipengine.org/doc/story/create5.html) + +[第六篇、创建小故事的封底页面](https://www.mipengine.org/doc/story/create6.html) + +[第七篇、小故事的添加统计](https://www.mipengine.org/doc/story/create7.html) + +[第八篇、小故事的MIP规范校验](https://www.mipengine.org/doc/story/create8.html) + + diff --git a/source/doc/story/create2.md b/source/doc/story/create2.md new file mode 100644 index 0000000..c38a55f --- /dev/null +++ b/source/doc/story/create2.md @@ -0,0 +1,110 @@ + +title: 创建小故事-小故事的组织结构 +layout: doc +--- + +## 小故事的组织结构 + +​ 本篇主要讲解小故事的结构划分和代码结构; + +## 知识储备 + +​ 在阅读本篇前,您需要了解什么小故事,如果您还不了解什么是小故事,可以查看[开发小故事前期准备](https://www.mipengine.org/doc/story/create1.html)了解基础信息; + + +## 小故事的组织结构介绍 + +​ 小故事主要由 [mip-story 组件](/examples/mip-extensions/mip-story.html) 承载,充当小故事中所有段落的容器,按照段落个数自动生成段落导航,返回链接,段落播放完的重播和分享功能。 + +小故事具有三个基本概念:段落(view),层(layer)和元素(element). + +- 每个小故事可以包含多个段落(view),每个段落充满屏幕。用户操作翻页后,会看到下一个段落。 +- 每个段落又可以包含多个层(layer),单个层可以设置布局模式,如多行布局,左右布局,图片拉伸布局等。 +- 元素(element)是资源素材,如背景图,主标题,详细描述等。在 `

`、`

`、`` 等标签中声明。 + +![intro-view-layer-element (1)](http://mipstatic.baidu.com/static/mip-static/mip-story/demo/static/intro-view-layer-element.jpg) + +​ 这里的每一个组件都是一个mip组件,其中故事组件为`mip-story`,段落为`mip-story-view`,层为`mip-story-layer`,元素为资源素材,如背景图,主标题,详细描述等。在 `

`、`

`、`` 等标签中声明。 + +![mip-story-tag-hierarchy](http://mipstatic.baidu.com/static/mip-static/mip-story/demo/static/demo-story1.png) + +## 开发小故事 + +开发一个小故事,只需要简单的三部: + +1. 创建封面以及段落; +2. 为段落添加丰富内容; +3. 为小故事添加封底; + +下面请跟随详细步骤教程开始制作你的第一个小故事吧! + +​ 小故事由`mip-story`组件表示,它作为故事中所有页面的容器。该`mip-story`组件还负责创建UI外壳,包括处理手势和导航。 + +​ `mip-story`组件是一个自定义的MIP组件,与所有自定义组件一样,您必须要将该组件的关联脚本添加到MIP文档;在一个标准的 [MIP HTML 页面](https://www.mipengine.org/doc/01-mip-demo.html)的` + + + + + + + +``` + +​ 添加好依赖后,需要把`mip-story`元素添加到``文档中,如下所示: + +```html + + + + .... + + + + + ... + + + + + + + + + + +``` + +​ 在此需要重点注意的是,要想获得有效的MIP故事,在``元素中必须只有一个``组件,所有其他元素(除` + + + + + + + +``` + + +## 我的标签 + +[第一篇、开发小故事前期准备](https://www.mipengine.org/doc/story/create1.html) + +[第二篇、小故事的组织结构](https://www.mipengine.org/doc/story/create2.html) + +[第三篇、创建小故事的封面](https://www.mipengine.org/doc/story/create3.html) + +[第四篇、开发更丰富的小故事段落](https://www.mipengine.org/doc/story/create4.html) + +[第五篇、小故事内置动画](https://www.mipengine.org/doc/story/create5.html) + +[第六篇、创建小故事的封底页面](https://www.mipengine.org/doc/story/create6.html) + +[第七篇、小故事的添加统计](https://www.mipengine.org/doc/story/create7.html) + +[第八篇、小故事的MIP规范校验](https://www.mipengine.org/doc/story/create8.html) + + diff --git a/source/doc/story/create6.md b/source/doc/story/create6.md new file mode 100644 index 0000000..7514f84 --- /dev/null +++ b/source/doc/story/create6.md @@ -0,0 +1,118 @@ +## 小故事分享页面 + +## 知识储备 + +​ 在阅读本篇前,您需要了解什么小故事,如果您还不了解什么是小故事,可以查看[开发小故事前期准备](https://www.mipengine.org/doc/story/create1.html)、[小故事的组织结构](https://www.mipengine.org/doc/story/create2.html)、[创建小故事的封面](https://www.mipengine.org/doc/story/create3.html)了解基础信息; + + +## 小故事分享页面的介绍 + +​ 到目前,您已经添加了所有的页面,那么当我们需要对一个小故事进行分享的时候,我们则需要创建一个分享页面。 + +​ 在分享页中,在 `` 段落最后提供了专门用于展示分享及小故事更多相关信息的页面。当用户在最后一个段落继续向后点击时候,即会出现。其中该页面内容需要通过开发者进行配置,具体使用范式和配置参数如下: + + + +```html + + + + + + + +``` + +如图所示: + + + + +除了share字段,我们还提供了别的字段,以丰富小故事的分享页面,具体使用方式如下: + +```html + + + + + + + +``` + +- share: share 字段下包含的是分享相关的数据。 +- share.thumbnail: 预览小故事的缩略图地址。 +- share.background: 结尾页背景图片地址。 +- share.title: 小故事标题。 +- share.from: 资源的来源信息。 +- recommend: 小故事推荐相关的信息。 +- recommend.items: 推荐小故事列表,它是一个数组,包含了所有推荐的小故事数据。 + - cover: 推荐的小故事背景图片。 + - url: 推荐的小故事跳转地址。 + - title: 推荐的小故事标题。 + - from: 推荐的小故事来源信息。 + - fromUrl: 推荐的小故事来源跳转地址。 + + + +在完成以上步骤,我们的小故事已经基本开发完成,但是在发布之前,我们需要对其进行校验,看是否属于MIP HTML的标准。 + + +## 我的标签 + +[第一篇、开发小故事前期准备](https://www.mipengine.org/doc/story/create1.html) + +[第二篇、小故事的组织结构](https://www.mipengine.org/doc/story/create2.html) + +[第三篇、创建小故事的封面](https://www.mipengine.org/doc/story/create3.html) + +[第四篇、开发更丰富的小故事段落](https://www.mipengine.org/doc/story/create4.html) + +[第五篇、小故事内置动画](https://www.mipengine.org/doc/story/create5.html) + +[第六篇、创建小故事的封底页面](https://www.mipengine.org/doc/story/create6.html) + +[第七篇、小故事的添加统计](https://www.mipengine.org/doc/story/create7.html) + +[第八篇、小故事的MIP规范校验](https://www.mipengine.org/doc/story/create8.html) + + diff --git a/source/doc/story/create7.md b/source/doc/story/create7.md new file mode 100644 index 0000000..3cb50c5 --- /dev/null +++ b/source/doc/story/create7.md @@ -0,0 +1,60 @@ +## 小故事添加统计 + +## 知识储备 + +在阅读本篇前,您需要了解什么小故事,如果您还不了解什么是小故事,可以查看[开发小故事前期准备](https://www.mipengine.org/doc/story/create1.html)、[小故事的组织结构](https://www.mipengine.org/doc/story/create2.html)、[创建小故事的封面](https://www.mipengine.org/doc/story/create3.html)和[创建小故事的封底页面](https://www.mipengine.org/doc/story/create6.html)了解基础信息; + +## 添加统计 + +​ 在完成一个小故事的开发以后,有时候我们需要对整个小故事的用户行为进行监控,因此需要使用统计组件,来进行统计,我们这里提供了两个组件便于用户使用。 + +- PV 使用 mip-pix 组件统计 + + `mip-pix`组件本身在页面不可见,但本元素只有滚动到屏幕可见范围内才触发初始化; + + - 示例 + + ```html + + ``` + + 详细的使用介绍可点击查看[mip-pix 组件](https://www.mipengine.org/examples/mip/mip-pix.html) + +- 交互行为日志使用 [mip-stats-baidu 组件统计](https://github.com/mipengine/mip-extensions/tree/master/src/mip-stats-baidu) + + - 示例 + + ```html + + + + ``` + +完成了统计添加,我们已经完成了一个小故事的整个开发,但是鉴于小故事是属于特殊的MIP页,因此小故事也要经过MIP页面校验,只有符合MIP页面规范的小故事才可以最终在搜索结果页展现。 + + +## 我的标签 + +[第一篇、开发小故事前期准备](https://www.mipengine.org/doc/story/create1.html) + +[第二篇、小故事的组织结构](https://www.mipengine.org/doc/story/create2.html) + +[第三篇、创建小故事的封面](https://www.mipengine.org/doc/story/create3.html) + +[第四篇、开发更丰富的小故事段落](https://www.mipengine.org/doc/story/create4.html) + +[第五篇、小故事内置动画](https://www.mipengine.org/doc/story/create5.html) + +[第六篇、创建小故事的封底页面](https://www.mipengine.org/doc/story/create6.html) + +[第七篇、小故事的添加统计](https://www.mipengine.org/doc/story/create7.html) + +[第八篇、小故事的MIP规范校验](https://www.mipengine.org/doc/story/create8.html) + + diff --git a/source/doc/story/create8.md b/source/doc/story/create8.md new file mode 100644 index 0000000..2d4fc28 --- /dev/null +++ b/source/doc/story/create8.md @@ -0,0 +1,89 @@ +## 小故事的MIP规范校验和搜索生效 + +## 知识储备 + +​ 在阅读本篇前,您需要了解什么小故事,如果您还不了解什么是小故事,可以查看[开发小故事前期准备](https://www.mipengine.org/doc/story/create1.html)、[小故事的组织结构](https://www.mipengine.org/doc/story/create2.html)、[创建小故事的封面](https://www.mipengine.org/doc/story/create3.html)和[创建小故事的封底页面]()了解基础信息; + +## 小故事的MIP规范校验 + +​ 当我们完成一个小故事页面的开发后,我们需要对小故事进行MIP规范的校验,原因是小故事页是属于MIP页的,因此为了可以试您的小故事在搜索结果页可以生效展示,需要对小故事进行MIP规范校验,目前MIP规范的校验有两种方式: + +- [MIP 校验工具](https://www.mipengine.org/validator/validate) + + 首先打开 [MIP 校验工具](https://www.mipengine.org/validator/validate) 的校验网页,把您开发的小故事页面代码复制粘贴到MIP代码校验工具的可视化区域,在网页的底部就会显示出您开发的小故事页面是否符合MIP规范。 + + 如果校验通过,则会显示绿色的**`SUCCESS → 验证成功,完全符合MIP规范`**提示您页面校验成功。 + + ![success](http://mipstatic.baidu.com/static/mip-static/mip-story/demo/static/success.png) + + 如果校验不通过,则会显示红色的**`ERROR → line x,col x:xxxxxxxx`** 提示您页面校验不成功,并且定位校验错的行号和列号。 + + ![fail](http://mipstatic.baidu.com/static/mip-static/mip-story/demo/static/fail.png) + + ​ + +- 使用[MIP-CLI](http://www.cnblogs.com/mipengine/p/mip_cli_1_install.html)工具中的`mip validate`命令 + + MIP-CLI:mip 开发工具,用于 MIP 页面和组件的开发和校验。 + 依赖环境: **Node.js (>=4.x)** + 输入`node -v` 查看 node 版本,如果版本为 5.x,6.x,[ 请点击这里 ](http://www.cnblogs.com/mipengine/p/mip_cli_1_install.html#question1)。 + + 示例: + + ![img](http://mip-doc.bj.bcebos.com/mip-blog-11/11_node_v.png) + + 将安装好的 node 打开 输入以下指令(mac系统需要sudo): + + ``` + $ npm install -g mip-cli + ``` + + mac系统需要使用以下指令: + + ``` + $ sudo npm install -g mip-cli + ``` + + 出现以下界面显示正在安装: + + ![img](http://mip-doc.bj.bcebos.com/mip-blog-11/11_install.png) + + 如果安装过程中有报错,[ 请点击这里查看解决办法 ](http://www.cnblogs.com/mipengine/p/mip_cli_1_install.html#question2)。 + + 检验是否安装成功可以输入`mip -V`,如果出现 mip 版本号,则表示安装成功。 + + ![img](http://mip-doc.bj.bcebos.com/mip-blog-11/11_mip_V.png) + + 此时您已经成功安装好MIP-CLI,在控制台直接输入`mip validate xxx.html`,其中xxx.html文件为您自己开发的mip页面。您可以查看是否通过校验。 + + 可以看到如果成功,控制台将显示以下提示: + + ![success1](http://mipstatic.baidu.com/static/mip-static/mip-story/demo/static/success1.png) + + 如果失败,控制台会显示失败原因,并且定位错误信息的出处: + + ![fail1](http://mipstatic.baidu.com/static/mip-static/mip-story/demo/static/fail1.png) + +​ 在校验的同时,可能会有各种报错,那么您可以通过查看[MIP校验错误列表](https://www.mipengine.org/doc/2-tech/2-validate-mip.html)来定位出错的位置和原因,修改并且重新校验,校验通过就可以提交部署MIP小故事页面了。 + + +## 我的标签 + +[第一篇、开发小故事前期准备](https://www.mipengine.org/doc/story/create1.html) + +[第二篇、小故事的组织结构](https://www.mipengine.org/doc/story/create2.html) + +[第三篇、创建小故事的封面](https://www.mipengine.org/doc/story/create3.html) + +[第四篇、开发更丰富的小故事段落](https://www.mipengine.org/doc/story/create4.html) + +[第五篇、小故事内置动画](https://www.mipengine.org/doc/story/create5.html) + +[第六篇、创建小故事的封底页面](https://www.mipengine.org/doc/story/create6.html) + +[第七篇、小故事的添加统计](https://www.mipengine.org/doc/story/create7.html) + +[第八篇、小故事的MIP规范校验](https://www.mipengine.org/doc/story/create8.html) + + +