Add Google Analytics to Pligg

July 24th, 2008

1. Open up footer.tpl from your template directory, Find :

<div class=”footer”>
 Powered By <a href=”http://www.pligg.com/”>Pligg</a> | Legal: <a href=”http://www.affero.org/oagpl.html”>License</a> and <a href=”https://sourceforge.net/project/showfiles.php?group_id=176676″>Source</a>
</div> 

2. Just below that add a new line and enter this date:
<script type=”text/javascript”>
var gaJsHost = ((”https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
document.write(unescape(”%3Cscript src=’” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
</script>
<script type=”text/javascript”>
var pageTracker = _gat._getTracker(”xx-xxxxxx-x”);
pageTracker._initData();
pageTracker._trackPageview();
</script>

Some person would say that you can add the Google Analytics code into header.tpl, but I am not agree that because put it in footer.tpl will make your webpage loading faster.

Use robots.txt to forbid duplicate content for search engines

July 24th, 2008

As mentioned by Optimize your pligg site for better SEO with these guide tutorial instructions :

Pligg Duplicate Content
Pligg story pages have a few URL’s that can be indexed by the search engines this can amount to duplicate content in their eyes, The easiest way to fix this is by a robots.txt file that is uploaded to your plug root directory.

http://www.designfloat.com/Programming/Elemental_Conditional_Content_with_CakePHP/
http://www.designfloat.com/story/title/Elemental_Conditional_Content_with_CakePHP/

Both the URLs above point to the same page a can be indexed by search engines which mean’s duplicate content, the fix is below…

1. Create a new blank text file and name it robots.txt.

2. Copy the text below and paste it into you robots.txt file.(Blue part is for pligg 0.9.9)

# All robots will spider the domain
User-agent: *
Disallow: /templates/
Disallow: /3rdparty/
Disallow: /libs/
Disallow: /modules/
Disallow: /plugins/
Disallow: /internal/
Disallow: /backup/
Disallow: /thickbox/
Disallow: /api/
Disallow: /evb/
Disallow: /avatars/
Disallow: /admin_index.php
Disallow: /admin
Disallow: /settings
Disallow: /sidebar_
Disallow: /class
Disallow: /config
Disallow: /story.php
Disallow: /login.php
Disallow: /user.php
Disallow: /js/
Disallow: /img/
Disallow: /story/
Disallow: /story/title/
Disallow: /languages/
Disallow: /templates_c/
Disallow: /install/

Get Pligg Friendly Urls (Url Method 2) working without 404 error

July 23rd, 2008

http://forums.pligg.com/general-help/2500-has-anyone-got-friendly-urls-url-method-2-working.html . Many People can not get Friendly Urls (Url Method 2) working correctly.  Faithfully, http://forums.pligg.com/wiki-articles/8594-url-method.html#post39130 had told everything to solve this problem. Below is my experience.

1.  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.

2. Open htaccess.default  and find these code:
##### You can find the below lines pre-made for you in the category management section of the admin panel ######
RewriteRule ^(all|pligg)/([^/]+)/?$ story.php?title=$2 [L]
RewriteRule ^(all|pligg)/?$ ?category=$1 [L]
#####

3. Paste over the line :
RewriteRule ^(all|pligg)/([^/]+)/?$ story.php?title=$2 [L]
RewriteRule ^(all|pligg)/?$ ?category=$1 [L]

4. Upload htaccess.default to your webserver in the root directory of your install.  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).

5. Go to your admin/Config Your Site Name/UrlMethod.  Choose Url Method 2 to enable static urls.

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

6. Go to your admin/Config Your Site Name/FriendlyURLs.  Make sure that values of “Friendly URL’s for stories” and “Friendly URL’s for categories” is both true.

After above steps, I had get static url working well. But when you change your catagory name, you should follow these steps once again, or you will dance with 404 error again.

Add a blog link at pligg top menu

July 23rd, 2008

1 Open head.tpl of your current template, 99% percent is yget. Find the code (2 place):
{if $Enable_Tags eq ‘true’}<a href=”{$URL_tagcloud}”>{#PLIGG_Visual_Tags#}</a> &nbsp;&nbsp; {/if}

2 Add the link code below above code:
<a href=’[your blog url]‘> Blog</a> &nbsp;&nbsp;

3 Save head.tpl. If you using FTP, upload to the server.

If you need the code more comfortable with pligg source code, please follow steps below

1 Open head.tpl of your current template, 99% percent is yget. Find the code (2 place)::
{if $Enable_Tags eq ‘true’}<a href=”{$URL_tagcloud}”>{#PLIGG_Visual_Tags#}</a> &nbsp;&nbsp; {/if}

2 Add the link code below above code:
<a href=’{$URL_blog}’> {#PLIGG_Visual_Blog#}</a> &nbsp;&nbsp;

3 Open html1.php in libs, Find the code :
$main_smarty->assign(’URL_topusers’, getmyurl(”topusers”));

4 Add the code below above code:
$main_smarty->assign(’URL_blog’, getmyurl(”blog”));

5 Find code in html1.php :
If ($x == “topusers”) {return my_pligg_base.”/topusers.php”;}

  Add the code below above code:
If ($x == “blog”) {return my_pligg_base.”/blog/”;}

  Find code:
If ($x == “topusers”) {return my_pligg_base.”/topusers”;}

  Add code below:
If ($x == “blog”) {return my_pligg_base.”/blog/”;}

7 Open your language config file, mostly is lang_english under /languages/. Find code:
PLIGG_Visual_Search_Go = “Go”

8 Add the code below above code:
//<SECTION>HEADER</SECTION><ADDED>0.80</ADDED>
PLIGG_Visual_Blog = “Blog”
After this step, you can modify “Blog” when your login with admin account, at “admin” - “modify language” - “Section: HEADER “. There is no need modify this at program file any more.

9. Backup and delete lang.conf in /libs/, copy lang_english.conf in /languages/ to /libs/ and rename it into lang.conf.