笔记:2016-06-25

<link rel="profile" href="http://gmpg.org/xfn/11"/>

XFN并不是某种神秘的新技术,它只是对传统技术的新应用。XFN通过标签中的rel属性来标示链接创造者与被链接者之间的关系。

// 一个传统的链接代码可能是:
<a href="http://www.mrven.com">布鲁文的蓝色奇想</a>
//而一个XFN的链接会是: 
<a href="http://www.mrven.com"  rel="friend met colleague">布鲁文的蓝色奇想</a>

rel="friend met colleague" 标示出了连接对象与我的关系是:朋友,见过面,同事。注意,这种关系是单向的,是从“我”到“对方”的,我给对方的XFN并不会影响对方给我的XFN。

XFN中共有6个关系分类,每个分类里又有多个具体的关系。一个连接中可以包含多个分类,但是某些分类下的关系类型只能选择一个(比如“家庭关系”),而一旦选中了“me”,那么就不能再放入任何其他的关系类型。以下是XFN中所有的关系类型:

friendship友情,只能选一个
friend 好朋友(一起混的)
acquaintance 熟人 (见面会打招会)
contact 有联系过 (至少你知道如何联系到Ta)
physical 直接接触
met 在真实世界中遇见过
professional 专业
co-worker 共事(一起合作过)
colleague 同事(与你共处同一专业领域)
geographical 地理关系,只能选一个
co-resident 同一区域(住同一个大院,同一个小区,同一个学校等等)
neighbor 邻居
family 家庭关系,只能选一个
child 孩子
parent 父母
sibling 兄弟姐妹
spouse 配偶
kin 亲属
romantic 恋爱关系
muse 我的女神
crush 我迷恋的
date 约会中
sweetheart 甜心
identity 自我识别
me 表示这个链接指向我的另一个节点(网站、网页等)

link标签 rel=”pingback“ href=”网址“ 什么作用?

首先介绍一下PingBack吧

PingBack是中常用的用来通知网志系统文章被引用情况的一种手段。"PingBack"的中文正确翻译为“广播”,最先由[3G博客网]提供,是指计算机系统向外部发出引用信息。

  当其他人连结至Web作者的网页时,Web作者获取通知的方法。这个方法使得Web作者可以追踪什么人连结至他的文章。有一些网志软体,如WordPress,具有当一篇文章出版的时候,自动pingback这篇文章中所有的连结的功能。

  造字:ping-back:ping的回溯。

  Ping网路上用来测试其他电脑是否存在的工具,取名字是声纳系统的声音。 牛奶咖啡网www.coffnet.com

  Alice写了一篇文章A

  Bob看了以後写了一篇文章B评论A,文章B中有一个LinkA 指向A。(一般来说,B有连结至A,A并不知情)。

  如何让A自动知道有人连结到他?可以靠Bob寄信给Alice,或是B所在的伺服器ServerB的程式,自动剖析B上面的连结LinkA,自动通知LinkA所指的A所在的伺服器ServerA 本文来自http://www.coffnet.com咖啡文学网

  ServerA 自动在A的後面的引用清单加上B

 

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

content属性值 :

     width:可视区域的宽度,值可为数字或关键词device-width

     height:同width

     intial-scale:页面首次被显示是可视区域的缩放级别,取值1.0则页面按实际尺寸显示,无任何缩放

     maximum-scale=1.0, minimum-scale=1.0;可视区域的缩放级别,

minimum-scale - 允许用户缩放到的最小比例
maximum-scale - 允许用户缩放到的最大比例
user-scalable - 用户是否可以手动缩放

 

<link rel="alternate" type="application/rss+xml" title=&qu

可以通过rss/读取内容

 

<htmllang="zh-cmn-Hans"><!-- 更加标准的 lang 属性写法 http://zhi.hu/XyIa -->

<head>

<!-- 声明文档使用的字符编码 -->

<metacharset='utf-8'>

<!-- 优先使用 IE 最新版本和 Chrome -->

<metahttp-equiv="X-UA-Compatible"content="IE=edge,chrome=1"/>

<!-- 页面描述 -->

<metaname="description"content="不超过150个字符"/>

<!-- 页面关键词 -->

<metaname="keywords"content=""/>

<!-- 网页作者 -->

<metaname="author"content="name, email@gmail.com"/>

<!-- 搜索引擎抓取 -->

<metaname="robots"content="index,follow"/>

<!-- 为移动设备添加 viewport -->

<metaname="viewport"content="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no">

<!-- `width=device-width` 会导致 iPhone 5 添加到主屏后以 WebApp 全屏模式打开页面时出现黑边 http://bigc.at/ios-webapp-viewport-meta.orz -->

<!-- iOS 设备 begin -->

<metaname="apple-mobile-web-app-title"content="标题">

<!-- 添加到主屏后的标题(iOS 6 新增) -->

<metaname="apple-mobile-web-app-capable"content="yes"/>

<!-- 是否启用 WebApp 全屏模式,删除苹果默认的工具栏和菜单栏 -->

<metaname="apple-itunes-app"content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">

<!-- 添加智能 App 广告条 Smart App Banner(iOS 6+ Safari) -->

<metaname="apple-mobile-web-app-status-bar-style"content="black"/>

<!-- 设置苹果工具栏颜色 -->

<metaname="format-detection"content="telphone=no, email=no"/>

<!-- 忽略页面中的数字识别为电话,忽略email识别 -->

<!-- 启用360浏览器的极速模式(webkit) -->

<metaname="renderer"content="webkit">

<!-- 避免IE使用兼容模式 -->

<metahttp-equiv="X-UA-Compatible"content="IE=edge">

<!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 -->

<metaname="HandheldFriendly"content="true">

<!-- 微软的老式浏览器 -->

<metaname="MobileOptimized"content="320">

<!-- uc强制竖屏 -->

<metaname="screen-orientation"content="portrait">

<!-- QQ强制竖屏 -->

<metaname="x5-orientation"content="portrait">

<!-- UC强制全屏 -->

<metaname="full-screen"content="yes">

<!-- QQ强制全屏 -->

<metaname="x5-fullscreen"content="true">

<!-- UC应用模式 -->

<metaname="browsermode"content="application">

<!-- QQ应用模式 -->

<metaname="x5-page-mode"content="app">

<!-- windows phone 点击无高光 -->

<metaname="msapplication-tap-highlight"content="no">

<!-- iOS 图标 begin -->

<linkrel="apple-touch-icon-precomposed"href="/apple-touch-icon-57x57-precomposed.png"/>

<!-- iPhone 和 iTouch,默认 57x57 像素,必须有 -->

<linkrel="apple-touch-icon-precomposed"sizes="114x114"href="/apple-touch-icon-114x114-precomposed.png"/>

<!-- Retina iPhone 和 Retina iTouch,114x114 像素,可以没有,但推荐有 -->

<linkrel="apple-touch-icon-precomposed"sizes="144x144"href="/apple-touch-icon-144x144-precomposed.png"/>

<!-- Retina iPad,144x144 像素,可以没有,但推荐有 -->

<!-- iOS 图标 end -->

<!-- iOS 启动画面 begin -->

<linkrel="apple-touch-startup-image"sizes="768x1004"href="/splash-screen-768x1004.png"/>

<!-- iPad 竖屏 768 x 1004(标准分辨率) -->

<linkrel="apple-touch-startup-image"sizes="1536x2008"href="/splash-screen-1536x2008.png"/>

<!-- iPad 竖屏 1536x2008(Retina) -->

<linkrel="apple-touch-startup-image"sizes="1024x748"href="/Default-Portrait-1024x748.png"/>

<!-- iPad 横屏 1024x748(标准分辨率) -->

<linkrel="apple-touch-startup-image"sizes="2048x1496"href="/splash-screen-2048x1496.png"/>

<!-- iPad 横屏 2048x1496(Retina) -->

<linkrel="apple-touch-startup-image"href="/splash-screen-320x480.png"/>

<!-- iPhone/iPod Touch 竖屏 320x480 (标准分辨率) -->

<linkrel="apple-touch-startup-image"sizes="640x960"href="/splash-screen-640x960.png"/>

<!-- iPhone/iPod Touch 竖屏 640x960 (Retina) -->

<linkrel="apple-touch-startup-image"sizes="640x1136"href="/splash-screen-640x1136.png"/>

<!-- iPhone 5/iPod Touch 5 竖屏 640x1136 (Retina) -->

<!-- iOS 启动画面 end -->

<!-- iOS 设备 end -->

<metaname="msapplication-TileColor"content="#000"/>

<!-- Windows 8 磁贴颜色 -->

<metaname="msapplication-TileImage"content="icon.png"/>

<!-- Windows 8 磁贴图标 -->

<linkrel="alternate"type="application/rss+xml"title="RSS"href="/rss.xml"/>

<!-- 添加 RSS 订阅 -->

<linkrel="shortcut icon"type="image/ico"href="/favicon.ico"/>

<!-- 添加 favicon icon –>

 

 

用于远程发布的link元素

如果你的主题中有<?php wp_head(); ?>这个函数,下面这两个link元素就会出现:

<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/wordpress/xmlrpc.php?rsd" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/wordpress/wp-includes/wlwmanifest.xml" />

这两个元素主要供远程发布使用,比如你使用Windows Live Write等桌面博客编辑器来发布文章。如果你并不需要这个功能,那完全可以把这两个元素删除,删除的方法是,打开你WordPress主题的functions.php, 在最底部的<?php } ?> 或者 ?> 标签之前,插入下面的代码:

remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');

注释: 你可能在想,既然是<?php wp_head(); ?>函数生成了这两个东西,把它删除不就可以了。是的,如果你预计你其它任何插件都不会需要到这个函数,那就删吧。

 

meta是用来在HTML文档中模拟HTTP协议的响应头报文。meta   标签用于网页的<head>与</head>中,meta   标签的用处很多。meta   的属性有两种:name和http-equiv。name属性主要用于描述网页,对应于content(网页内容),以便于搜索引擎机器人查找、分类(目前几乎所有的搜索引擎都使用网上机器人自动查找meta值来给网页分类)。这其中最重要的是description(站点在搜索引擎上的描述)和keywords(分类关键词),所以应该给每页加一个meta值。比较常用的有以下几个: 
  name   属性
  1、<meta   name= "Generator "   content= " ">用以说明生成工具(如Microsoft   FrontPage  4.0)等;
  2、<meta   name= "KEYWords "   content= " ">向搜索引擎说明你的网页的关键词;
  3、<meta   name= "DEscription "   content= " ">告诉搜索引擎你的站点的主要内容;
  4、<meta   name= "Author "   content= "你的姓名 ">告诉搜索引擎你的站点的制作的作者;
  5、<meta   name= "Robots "   content= "all|none|index|noindex|follow|nofollow ">
  其中的属性说明如下:
  设定为all:文件将被检索,且页面上的链接可以被查询;
  设定为none:文件将不被检索,且页面上的链接不可以被查询;
  设定为index:文件将被检索;
  设定为follow:页面上的链接可以被查询;
  设定为noindex:文件将不被检索,但页面上的链接可以被查询;
  设定为nofollow:文件将不被检索,页面上的链接可以被查询。
  http-equiv属性
  1、<meta   http-equiv= "Content-Type "   content= "text/html ";charset=gb_2312-80 ">
  和   <meta   http-equiv= "Content-Language "   content= "zh-CN ">用以说明主页制作所使用的文字以及语言;
  又如英文是ISO-8859-1字符集,还有BIG5、utf-8、shift-Jis、Euc、Koi8-2等字符集;   2、<meta   http-equiv= "Refresh "   content= "n;url=http://yourlink ">定时让网页在指定的时间n内,跳转到页面http;//yourlink;
  3、<meta   http-equiv= "Expires "   content= "Mon,12   May   2001   00:20:00   GMT ">可以用于设定网页的到期时间,一旦过期则必须到服务器上重新调用。需要注意的是必须使用GMT时间格式;
  4、<meta   http-equiv= "Pragma "   content= "no-cache ">是用于设定禁止浏览器从本地机的缓存中调阅页面内容,设定后一旦离开网页就无法从Cache中再调出;
  5、<meta   http-equiv= "set-cookie "   content= "Mon,12   May   2001   00:20:00   GMT ">cookie设定,如果网页过期,存盘的cookie将被删除。需要注意的也是必须使用GMT时间格式;
  6、<meta   http-equiv= "Pics-label "   content= " ">网页等级评定,在IE的internet选项中有一项内容设置,可以防止浏览一些受限制的网站,而网站的限制级别就是通过meta属性来设置的;
  7、<meta   http-equiv= "windows-Target "   content= "_top ">强制页面在当前窗口中以独立页面显示,可以防止自己的网页被别人当作一个frame页调用;
  8、<meta   http-equiv= "Page-Enter "   content= "revealTrans(duration=10,transtion=50) ">和<meta   http-equiv= "Page-Exit "   contect= "revealTrans(duration=20,transtion=6) ">设定进入和离开页面时的特殊效果,这个功能即FrontPage中的“格式/网页过渡”,不过所加的页面不能够是一个frame页面。

 

 

 

如何查看Shortlink缩短网址

在编辑文章时会出现Get Shortlink按钮,可以查看到当前文章的短链接。WordPress默认在新添加模式下没有出现,只在编辑模式下才会出现,因为发布之前该记录还没有正式保存进数据库(不算自动保存auto-draft),没有确定的ID编号,这个编号正是shortlink中的默认参数。

以上Shortlink无法直接手动修改掉,看源代码,似乎只有通过过滤函数(或插件)进行处理,具体参见wp-includes\link-template中的wp_get_shortlink函数说明(pre_get_shortlink),如果没有过滤器,默认就是拼接成?p=id形式。

二、默认生成shortlink形式

启用shortlink后,正式发布的文章代码中都会带上这么一条

其中<link rel='shortlink' href='http://localhost/?p=1234' />其实就是文章缩短网址,前面的canonical是为防止重复收录声明,出现shortlink还有个前提就是要启用固定链接地址,否则可能两个地址是相同(实际不会生成)。

三、如何启用和禁用shortlink

1、如何启用这个shortlink编辑功能

在文件wp-admin\edit-form-advanced.php中 有这么一句:

$shortlink = wp_get_shortlink($post->ID, 'post');

if ( !empty($shortlink) )

$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button" οnclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';

就是显示按钮语句。 wp_get_shortlink函数声明在wp-includes/link-template.php中。

2、如何在文章页面启用shortlink功能

在主题functions.php中增加:

add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );

该功能在WordPress 3.0中已经默认开启,在default-filter.php中,该函数用来在header中生成<linkrel='shortlink' href='http://localhost/?p=1234' />这样的缩短网址。

3、如何禁用shortlink功能

在主题functions.php中增加:

remove_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );

以上的启用和禁用在WordPress 3.0之后版本会自动生效的。

4、如何需要手动调用日志展示页的shortlink

请使用以下函数:

<?php the_shortlink( $text, $title, $before, $after ); ?>,如果要兼容早期WordPress版本,就加上function_exists('the_shortlink') )判断。

四个参数(WordPress官方参考):

text——显示文本,默认是“This is the short link.”

title——提示文本,默认是该日志标题

before——为链接地址前增加文本或HTML标记,该参数及下面的after参数一般是用来为缩短网址风格化使用。

after——为链接地址后增加文本或HTML标记

比如,想输出:

<ul><li><a rel="shortlink" href="http://localhost/?p=14" title="I am ShortLink">Visit to ShortLink</a></li></ul>

则使用如下调用:

<?php the_shortlink( 'Visit to ShortLink', 'I am ShortLink', '<ul><li>', '</li></ul>' ); ?>

转载于:https://www.cnblogs.com/binperson/p/5616160.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值