【问题标题】:How does Google indexes the backend .net MVC code for SEO optimization?Google 如何索引后端 .net MVC 代码以进行 SEO 优化?
【发布时间】:2015-10-26 18:40:46
【问题描述】:

我有一个在 MVC .net 中开发的应用程序。应用程序中的所有内容都必须针对 SEO 进行优化。我想知道网页上的内容(如标题、元标记)是否通常呈现为静态上下文,Google 可以轻松索引该页面。

但是,如果网站是在 .net MVC 中开发的,其中主要代码从 MVC 动态加载,Google 如何为此类页面编制索引以进行 SEO 和排名。

这是我网站的代码。 一个工作的静态页面(在 MVC 纯静态 HTML 中没有后端/动态内容)

<!doctype html>
<html>
 <head>
  <title>jQuery Child Filter Selectors</title>
  <meta name="Keywords" content="jquery child selectors, jquery first-child selector, jquery last-child,first-of-type,jquery-nth-child,">

  <meta name="Description" content="Learn about all the jQuery child selectors with interactive live examples covering jquery first-selector, last-selector, jquery nth-selector and others ">
 </head>

 <body>
   <div class="main-wrapper">
   <div class="wrapper">
    <ul>
        <li><a href="../html/html-home.html">HTML</a></li>
        <li><a href="../css-tutorials/css-home.html">CSS</a></li>
        <li><a href="../javascript/javascript-home.html">Javascript</a></li>
        <li><a href="../jquery/jquery-home.html">jQuery</a></li>
        <li><a href="../references/web-references.html">Web References</a></li>
        <li><a href="../articles/articles-home.html">Articles</a></li>
    </ul>
   </div>


<h1>jQuery Child Filter Selectors</h1>

<h1>jQuery first-child Selector</h1>
<div class="alert alert-info">
<p>jQuery <code>first-child</code> selector is used to select all the <code>HTML</code>elements which are the first child of their parent.
</p>
</div>


<b style="font-size:20px;">Syntax</b>
<textarea class="myTextareaCss">
$( ":first-child" )
</textarea>


<div id="footer">
<div class="section section-standout section-slim">
    <div class="container">
        <div class="row row-gap-huge hidden-xs"></div>
        <h4>References</h4>
    <p class="caption">
        <a href="../references/html-reference.html">HTML References</a>
        <br>
        <a href="../references/css-reference.html">CSS References</a>
        <br>
        <a href="../references/javascript-reference.html">JavaScript References</a>
        <br>
        <a href="../references/jquery-reference.html">jQuery References</a>

<!-- end of the page -->
 </body>

</html>

上述静态 HTML 代码已被 Google 完美索引。我的问题是,如果我使用 MVC.net 框架转换相同的代码,Google 是否正确索引了我的页面。

这是我转换后的MVC代码:

注意:转成MVC后所有的(head, body, title标签都会动态加载)

@{

    ViewBag.Title = " jQuery Child Filter Selectors";
}

@section AdditionalMeta
{

<meta name="Keywords" content="jquery child selectors, jquery first-child selector, jquery last-child,first-of-type,jquery-nth-child,">

<meta name="Description" content="Learn about all the jQuery child selectors with interactive live examples covering jquery first-selector, last-selector, jquery nth-selector and others ">


}

 <div class="main-wrapper">
   <div class="wrapper">

   <!-- Dynamically load the left menu -->
    @Html.Partial("~/Views/CSS/commonLeftMenu.cshtml")

   </div>


<h1>jQuery Child Filter Selectors</h1>

<h1>jQuery first-child Selector</h1>
<div class="alert alert-info">
<p>jQuery <code>first-child</code> selector is used to select all the <code>HTML</code>elements which are the first child of their parent.
</p>
</div>



<b style="font-size:20px;">Syntax</b>
<textarea class="myTextareaCss">
$( ":first-child" )
</textarea>





<!-- Dyntamically load the footer -->

@Html.Partial("~/Views/CSS/commonRightMenu.cshtml")


<!-- end of the page -->

以上 MVC 代码是否被 Google 和其他搜索引擎正确索引,如果不是,我可以做些什么来优化我的网站,该网站有 1000 多个与上述类似的网页。

【问题讨论】:

    标签: c# html asp.net asp.net-mvc asp.net-mvc-4


    【解决方案1】:

    您似乎对 MVC 和 Razor 的工作方式有一个彻底的误解。 Google 看到的是生成的 HTML,而不是你的 Razor 标记。 Razor 在服务器端解析,生成 HTML。

    查看它生成的 HTML,并确保它与当前的 HTML 大致相同。

    不要使用“动态”,这是一个流行词。编程中的一切都是动态的。您不是在“动态加载”任何东西,而是在渲染部分内容。这发生在服务器端,对生成的 HTML 没有影响。

    现在,当您使用 AJAX 加载内容时,情况就完全不同了。

    【讨论】:

      【解决方案2】:

      Google bot 没有发现任何差异。

      它将请求页面并取回生成的 HTML 代码,因此它不关心它是静态页面还是生成的页面。它永远不会看到服务器代码,只会看到运行代码的结果。

      当您请求页面时,甚至无法确定区别。生成的页面通常具有与静态页面不同的文件扩展名(例如 .aspx 而不是 .html),但生成的页面也可以使用与静态页面相同的文件扩展名来提供。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-02-26
        • 2012-03-08
        • 2017-01-30
        • 2016-06-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多