nuxt SEO项目经验总结

2,133 阅读2分钟

一 、TKD优化(title、keyword、description)

1.对于不同的html页面采用不同的title、keyword、description

2.增加网站的多端说明 比如pc端中 添加 移动端说明

  // TKD      
title: this.indexInfo.tkdVO ? this.indexInfo.tkdVO.tkdTitle : 'xxx',      
meta: [        
   { name: 'description',content: this.indexInfo.tkdVO ? this.indexInfo.tkdVO.tkdDescription : 'xxx' },       
   { name: 'keywords',content: this.indexInfo.tkdVO ? this.indexInfo.tkdVO.tkdKeywords : 'xxx'},        
   { name: 'applicable-device', content: 'pc' },        
   { 'http-equiv': 'Cache-Control', content: 'no-transform' },        
   { 'http-equiv': 'Cache-Control', content: 'no-siteapp' },        
   { name: 'mobile-agent',content: ` format=wml;url=https://h5.xxx.com `},        
   { name: 'mobile-agent',content: ` format=xhtml;url=https://h5.xxx.com `},           { name: 'mobile-agent',content: ` format=html5;url=https://h5.xxx.com `}]

二、尽量减少网站的非必须的301 、302 、304重定向访问

它可能会导致:

① 百度蜘蛛抓取频率逐渐降低。

② 新增内容页面,收录缓慢,甚至网站不收录。

③ 关键词排名逐渐平稳下降。

三、html  a标签 rel =‘nofollow’属性

对于网站SEO优化的人来说,rel=”nofollow”大家都不太陌生,特别是很多站长在和其他网站进行友情链接的交换的时候,其中重要的一项指标就是友情链接不能带有nofollow。

nofollow是一个HTML标签的属性值,随着搜索引擎优化(SEO)的兴起,它渐渐被大家所了解,这个标签的意思是告诉搜索引擎不要此网页上的链接或不要追踪此特定链接。如果A网页上有一个链接指向B网页,但A网页给这个链接加上了
rel=”nofollow” 标注,则搜索引擎不把A网页计算入B网页的反向链接。搜索引擎看到这个标签就可能减少或完全取消链接的投票权重。

四、使用中间层服务器 缓存提高访问效率

在node中间层使用node中间件 lru 设置缓存

# 通过npm安装  npm install lru

const LRU = require('lru'); 
const cache = new LRU(2),   
    evicted 
cache.on('evict',function(data) { evicted = data }); 
cache.set('foo', 'bar');
cache.get('foo'); //=> bar

五、利用http  gzip压缩减少资源传输大小

因为我们的项目正是环境是放在阿里云上的,于是可以利用阿里云的压缩功能对 css 、js资源文件进行gzip压缩