node.js - 我使用 Yeoman/Grunt 和 Node.js 创建了一个网站只是为了构建我的应用程序,我该如何使用预渲染或 seo4ajax 并对其进行索引?

标签 node.js gruntjs seo prerender

我使用 Yeoman 制作了一个网站; grunt , generator-angular, $routeParams ... 与 Node.js 只是为了 build 我的应用程序,如何使用 prerenderseo4ajax 并为其编制索引?

使用 Node.js 作为应用服务器可以这样设置: 在命令行上运行:$ npm install prerender-node --save

当您设置 Express 应用时...:app.use(require('prerender-node'));

但是,我只使用 Node.js 来构建我的应用程序,我没有 express 这个应用程序,我如何安装和配置 nginx(我使用托管 Godaddy)来获取索引我网站的内容?

最佳答案

Google 提供了一些在 ajax 中进行内容索引的工具,现在我的网站出现在搜索引擎/研究中。

转到:https://www.google.com/webmasters/tools/googlebot-fetch?hl=
添加站点,然后转到 trace> Fetch as Google 并输入您要呈现的页面,然后进行索引。该站点还有许多其他出色的工具可以帮助我们在 Ajax 中为内容编制索引。

更多信息:https://support.google.com/webmasters/answer/6066467?hl=en

Yannick 的 SEO4Ajax 为 .htaccess 和社交网络提供了这些模块:将 yousite 替换为您的域名,将 put you token 替换为他的 token (以在以下位置获取 token 注册:seo4ajax.com),然后复制并粘贴到您的 .htaccess 中。

<IfModule mod_headers.c>
RequestHeader set Host "api.seo4ajax.com"
</IfModule>

<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
Options +FollowSymLinks
# Redirect yousite.com to www.yousite.com
RewriteCond %{HTTP_HOST} ^yousite\.com [NC]
RewriteRule ^(.*) http://www.yousite.com/$1 [L,R=301]

<IfModule mod_proxy_http.c>
# If requested with the _escaped_fragment_ query parameter, proxify
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !(index.html) [NC]
RewriteCond %{QUERY_STRING} _escaped_fragment_= [NC]
RewriteRule .* - [E=PROXIFY:true]

# If requested by a bot that does not support the specification, proxify
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !(index.html) [NC]
RewriteCond %{HTTP_USER_AGENT}  !(google.*bot|bing|msnbot|yandexbot|pinterest.*ios|mail\.ru) [NC]
RewriteCond %{HTTP_USER_AGENT}  (bot|crawler|spider|archiver|pinterest|facebookexternalhit|flipboardproxy) [NC]
RewriteRule .* - [E=PROXIFY:true]

# Proxification to SEO4Ajax
RequestHeader set Host "api.seo4ajax.com" env=PROXIFY
RewriteCond  %{ENV:PROXIFY}  true
RewriteRule ^(.*)$ http://api.seo4ajax.com/put you token/$1 [P,QSA,L]
</ifModule>
# html5 pushstate enable
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^ index.html [L]
</ifModule>

从您的数组中传递信息以获取模式和元属性。 将该模式和元属性放在他们的 View 中。

<div ng-repeat="item in grupo">
   <!-- Schemas -->
   <div span itemscope itemtype="http://schema.org/Article"></span>
   <span itemprop="name" content="{{item.title}}"></span>

   <span itemprop="description" content="{{item.description}}"></span>

   <span itemprop="articleSection" content="Humor"></span>

   <span itemprop="image" content="http://www.yousite.com/images/{{item.img}}" ></span>
   </div>
   <!-- End - Schemas -->

   <!-- Meta property  -->
  <meta property="og:title" content="{{item.title}}" />
  <meta property="og:image" content="http://www.yousite.com/images/{{item.img}}" />
  <meta property="og:description" content="{{item.description}}" />
  <!-- End - Meta property  -->
</div>

关于node.js - 我使用 Yeoman/Grunt 和 Node.js 创建了一个网站只是为了构建我的应用程序,我该如何使用预渲染或 seo4ajax 并对其进行索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29840019/

相关文章:

javascript - Promises 和 Nodejs 的具体示例(无解决方案)

node.js - V8引擎编译器错误报告

node.js - 生成器角度全栈 : how to run just the Server

gruntjs - 如何将参数传递给 grunt.file.readJSON?

Apache Rewrite - 重定向通配符子域和处理内部 URL 缩短器

wordpress - 将静态站点转换为 Wordpress 站点...如何传输/转换 SEO 排名?

node.js - 如何使用 NodeJS 从 EC2 连接和查询 PostgreSQL RDS?

javascript - sequelize 日期范围之间的查询(createdAt)

node.js - 最新的 grunt-express 不起作用

search - 将旧网站转移到新框架网站并托管后如何修复谷歌搜索引擎优化?