出家如初,成佛有余

pligg SEO支持

Posted in Uncategorized by chuanliang on 2007/10/14

为了更好让pligg支持搜索引擎优化,按照SEO的基本原则进行如下一些处理

pligg版本:Pligg_Beta_9.8.2

1、meta keywords和descriptions的配置

Pligg缺省情况下以提交digg内容时候定义的keywords和summary作为页面的keywords和description内容。对于一些站点缺省的keyword或description的维护,可以直接修改tempaltes/meta.tpl,但这样很麻烦,可以通过“后台管理”提供的对lang.conf维护工具来实现keyworkds和descriptions缺省值进行动态维护和修改。

方法如下:

  • 在libs/lang.conf中增加如下内容:

//<SECTION>MISC</SECTION><ADDED>0.5</ADDED>
PLIGG_Meta_Description = “ENTER YOUR DESCRIPTION HERE”
//<SECTION>MISC</SECTION><ADDED>0.5</ADDED>
PLIGG_Meta_Keywords = “ENTER YOUR KEYWORD HERE”

  • 在templates/meta.tpl增加PLIGG_Meta_Description和PLIGG_Meta_Keywords
{* define your meta data here *}

{if $meta_description neq ""}
        <meta name="description" content="{$meta_description},{#PLIGG_Meta_Description#}" />
{else}
        <meta name="description" content="Yeeach.com" />
{/if}

{if $meta_keywords neq ""}
        <meta name="keywords" content="{$meta_keywords},{#PLIGG_Meta_Keywords#}" />
{else}
        <meta name="keywords" content="Yeeach.com" />
{/if}
        <meta name="Language" content="{#PLIGG_Visual_Meta_Language#}" />
        <meta name="Robots" content="All" />

{* the extra tabs are to make it lineup when viewing the source *}

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

  • 从“后台管理”->“设定配置”->“Modify Language”修改keyworkds和descriptions

2、URL搜索引擎友好

  • 从“后台管理”->“设定配置”->“Outgoing”将Outgoing links的值设定为id
  • 从“后台管理”->“设定配置”->“UrlMethod”将URL method将值设定为2
  • 从“后台管理”->“设定配置”->“FriendlyURLs”将Friendly URL’s for stories和Friendly URL’s for categories的值设定为false
  • cp htaccess.default .htaccess
  • 登录“后台管理”->“类别管理”,得到最下方自动生成的RewriteRule,拷贝到.htaccess,替代如下内容后面的内容##### You can find the below lines pre-made for you in the category management section of the admin panel
  • 如果新增了类别,需要重新到“后台管理”->“类别管理”得到新的RewriteRule,然后拷贝到.htaccess中。
  • 之所以将Friendly URL’s for stories和Friendly URL’s for categories的值设定为false,就是为了采用id号方式,避免中文编码urlencode后,mod_rewrite处理的问题。

http://forums.pligg.com/wiki-articles/8594-url-method.html

Dynamic vs Static urls

Dynamic urls contain variables and are typically seen on database driven sites like blogs and forums. A static url does not contain any variables and does not change. Static urls are easier for your users to read. They are also sometimes ranked higher by search engines.
Examples
Dynamic url: yoursite.com/pligg/story.php?title=storytitle
Static url: yoursite.com/pligg/news/yourstorytitle

Url Method options

There are three options on the Url Method page in the admin panel. Choose Url Method 2 to enable static urls.

  • Method 1 = dynamic urls (default)
  • Method 2 = static urls

.htaccess

If you enable Url Method 2 in the admin panel you should see static urls on your site but when you click on an internal link you’ll probably get a 404 this page can not be found error. In order to work properly Url Method 2 requires modifications to your .htaccess file so that so that the new friendly urls are properly mapped to the actual files they refer to.
There is a default .htaccess file included in your Pligg installation called htaccess.default that contains a long list of rewrite commands that are meant to get you started. But you will probably need to modify this file in order to get static urls working properly on your site.

Step by Step Instructions
  1. Check with your host to see if mod rewrite is allowed. If not buy a DreamHost package to help pligg dev.
  2. Check with your host that Apache is configured to use .htaccess files (AllowOverride All)
  3. Get the latest htaccess.default from the SVN on sourceforge.
  4. Go to your admin panel/category management. At the bottom there is a rewrite rule for the categories. Copy this whole line and in htaccess.default paste over You need to copy the line for this whole thing to work right. Paste over the line: RewriteRule ^(all|pligg|category1|category2)/([a-zA-Z0-9-]+)/?$ story.php?title=$2 [L]
  5. Upload htaccess.default to your webserver in the root directory of your install. Overwrite the existing one.
  6. Rename “htaccess.default” to “.htaccess” (no quotes). Note the period in front. That period denotes a hidden file, and may cause it to disappear from some FTP clients. (You might need to enable showing of hidden files or call it by name when downloading).
  7. Turn on URL Method 2 in the admin panel.
  8. Enjoy friendly URL’s

If your Pligg is installed in a subfolder

If Pligg is installed in a subfolder: (ie : yourdomain.com/pligg/) then you will need to modify the RewriteBase in .htaccess:
Change RewriteBase / to RewriteBase /pligg/

Rewrite rule for categories

Every time you add a new category to your site you need to update the mod rewrite rules for the category urls. Simply go back to the admin panel / category management page copy the new rewrite rule and paste it on top of the old one in your .htaccess file.

It’s not working. How do i go back?

If this doesn’t work, mod_rewrite probably isn’t enabled on your webserver. You can go back to the admin panel and set Url Method to 1 again. No harm was done to any files during the instructions above and your site should operate fine without friendly urls.

3、广告

http://www.maranan.us/archives/pligg-ad-placement-tutorial/

http://www.maranan.us/archives/pligg-adsense-tutorial-yget-template/

http://www.maranan.us/archives/putting-adsense-in-your-pligg-sites/

 

 

参考资料

Technorati 标签: , , ,
Tagged with: , , ,

No Responses Yet

Subscribe to comments with RSS.

  1. 唱片机 said, on 2008/03/19 at 08:40

    你好,很感谢你分享这篇文章,我照着步骤一步步做了。
    修改完成,测试,基本正常。
    但在编辑修改已发表文章,完成后点击提交,跳转到页面http://www.wawo.biz/story/,提示该页面不存在,并且编辑的内容未修改完成。
    我使用Pligg_Beta_9.9.0
    请问该如何解决?谢谢!

  2. tushu said, on 2008/04/18 at 20:57

    很有用!

  3. pligg.com said, on 2008/07/25 at 09:54

    Pligg | 出家如初,成佛有余…

    从“后台管理”->“设定配置”->“Outgoing”将Outgoing links的值设定为id
    从“后台管理”->“设定配置”->“UrlMethod”将URL method将值设定为2
    从“后台管理”->“设定配置”->“FriendlyURLs”将Friend…


发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: