zoukankan      html  css  js  c++  java
  • 最简单的设置Title和关键字方法,方便你做搜索引擎检索

    public class PageSeo
        {
            public static void getSeoInfo(string pages)
            {
                try
                {
                    string strsql = "select title,keyword,description from pageSeo where page='" + pages + "'";
                    DataSet ds = ErnieManager.getDatasetByStrsql(strsql);
                    if (ds.Tables[0].Rows.Count < 0)
                    {

                    }
                    else
                    {
                        string titleInfo = "<title>" + ds.Tables[0].Rows[0]["title"] + "</title>";
                        string keywordInfo = "<meta name=\"keywords\" content=\"" + ds.Tables[0].Rows[0]["keyword"] + "\" />";
                        string description = "<meta name=\"description\" content=\"" + ds.Tables[0].Rows[0]["description"] + "\">";
                        System.Web.HttpContext.Current.Response.Write(titleInfo + keywordInfo + description);
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }

    很久很久之前写的,方法也许不是太好,期待有你的更好办法!

    qq讨论群  :  171560784

  • 相关阅读:
    本周面试总结
    本周面试总结
    本周面试题总结
    网络请求AJAX
    es6数组、对象的解构赋值
    es6箭头函数
    es6总结
    js限定输入为数字包括负数正则
    js限定输入为非负数,浮点数正则
    js数值千分隔(正则)
  • 原文地址:https://www.cnblogs.com/kezhiping/p/3048955.html
Copyright © 2011-2022 走看看