Angular SEO方案

1、如果是java web项目,可以直接使用AngularSEO Filter。

               官网地址 :http://www.angularseo.net/#about

 

 


<filter>
	<filter-name>SEOFilter</filter-name>
	<display-name>SEOFilter</display-name>
	<description>AngularSEO Filter</description>
	<filter-class>net.angularseo.SEOFilter</filter-class>
	<!-- The path to the PhantomJS binary -->
	<init-param>
		<param-name>phantomjs.binary.path</param-name>
		<param-value>C:\\phantomjs2.0\\bin\\phantomjs.exe</param-value>
	</init-param>
	<!-- The time waiting the JS page to finish the dynamic loading, unit is second.
	 -->
	<init-param>
		<param-name>waitForPageLoad</param-name>
		<param-value>3</param-value>
	</init-param>
	<!-- Filter already embed google, bing, baidu UserAgent keywords,
	     If you want to support more, add them and split with |
	 -->
	<init-param>
		<param-name>robotUserAgents</param-name>
		<param-value>YodaoBot|Zealbot</param-value>
	</init-param>
	<!-- The interval that SEOFilter update the static page snapshot -->
	<init-param>
		<param-name>cacheTimeout</param-name>
		<param-value>24</param-value>
	</init-param>	
	<!-- The path to save the static version pages -->
	<init-param>
		<param-name>cachePath</param-name>
		<param-value>c:\\cache</param-value>
	</init-param>
	<!-- crawlDepth is used to limited the crawl depth -->
	<init-param>
		<param-name>crawlDepth</param-name>
		<param-value>10</param-value>
	</init-param>
	<!-- The default page encoding of this site -->
	<init-param>
		<param-name>encoding</param-name>
		<param-value>UTF-8</param-value>
	</init-param>		
</filter>
<filter-mapping>
	<filter-name>SEOFilter</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>
                     

  

 

关于phantomjs: http://phantomjs.org/

 

 

2、后台针对每一个需要SEO的页面分别写一套,在后台渲染生成html的代码,嵌入到前台的html中,但是不显示。

<div style="display:none">
        ///后台生成的专门为了SEO需要的代码
        //在后台可以通过判断请求的agent参数,判断是否是搜索引擎爬虫,如果不是,不需要生成这段隐藏的代码。
</div>

<div ng-app="XXApp" ng-controller="XXController">
       //前台业务的代码
</div>

  

 

 

转载于:https://www.cnblogs.com/lhp2012/p/5229954.html

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值