Surendra Sharma

Surendra Sharma

Search This Blog

Sunday, February 22, 2015

How to generate Sitemap for your website online

There are situation when you are going to deploy your website on production and client want Sitemap file of website. Sitemap file is used to improve SEO results.

If you are going to create it manually, your require two things
  • If you must know all the pages name of your site
  • Time - as it’s a time taking process to create this file.

But there is good news you can create it online and within a minute. Here are the steps to do it.


- Visit website https://www.xml-sitemaps.com and enter your full website URL and some optional parameters in the form below.

- Press 'Start' button and wait until the site is completely crawled.

- You will be redirected to the generated sitemap details page, including number of pages, broken links list, XML file content and link to a sitemap file.
  Download the sitemap file using that link and put it into the domain root folder of your site.

- Go to your Google Webmaster account and add your sitemap URL.

Put this file into your virtual directory.


In case of Sitecore, put this sitemap.xml under "website" folder.

Please leave your comments or share this tip if it’s useful for you.

Thursday, February 19, 2015

Language suffix 'en' is being added into the URL of Sitecore website

Recently I come across with interesting requirement in Sitecore.

Whenever any new user tries to access any page of website first time, language suffix ‘en’ is adding into the URL. If same user tries to access the same page again then ‘en’ is not including into the URL. Let’s understand it with example.

When the user is on www.abc.com  and clicks to go to the any pages, the URL user is taken to is http://www.abc.com/en/abc , which should be www.abc.com/abc  and when user clicks LMN link, URL is http://www.abc.com/en/LMN , should be www.abc.com/LMN .

This is only occurring the first time the user visits the page. If the user clicks away from one of these pages to a different page and then clicks back to the previous page, the URL's no longer contain the 'en'.

How to fix this?

Open web.config file and locate languageLocation in linkManager section. Its different values are asNeeded, always and never. By default its asNeeded so language siffix added into the URL first time the user visits the page.
If you set Never, you will never get the language suffix in URL.

    <linkManager defaultProvider="sitecore">
      <providers>
        <clear/>
        <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="never" languageLocation="filePath" lowercaseUrls="true" shortenUrls="true" useDisplayName="false"/>
      </providers>
    </linkManager>


Please leave your comments or share this tip if it’s useful for you.

Wednesday, February 18, 2015

Google Analytic tracking script

Google analytic is great way to track your website access and view of different pages.

Question is how to implement analytic in your web project?

To work with this you need Google tracking ID. I represented it as “NNNNN”. In project store it either in web.config or database. Below is script that you need to place it before the end of </body> section of webpage.

<script type="text/javascript">

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'NNNNN']);
    _gaq.push(['_trackPageview']);

    (function () {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();

</script>


Please leave your comments or share this script if it’s useful for you.

Tuesday, February 17, 2015

How to store WFFM data in SQL Server instead of SQLite database in Sitecore

When you install WFFM package, by default it store data in SQLite database.

Disadvantage with SQLite is that it creates the database on disk and it’s not centralized.
However Sitecore provides a way to store WFFM data in SQL server.

Here are the steps to do it.

·         Restore database in SQL server from “Website\Data\Sitecore_WebForms.bak
·         Change “Sitecore.forms.config” file in “Website\App_Config\Include” where comment SQLLite section and uncomment MS SQL section and put the new connection string for restored database as shown below

    <!-- DLINQ compatible data storage -->
    <!-- MS SQL -->
   
    <formsDataProvider type="Sitecore.Forms.Data.DataProviders.WFMDataProvider,Sitecore.Forms.Core">
      <param desc="connection string">user id=abc;password=xyz;Data Source=your DS;Database=dbname</param>
    </formsDataProvider>
   

    <!-- Oracle -->
    <!--
    <formsDataProvider type="Sitecore.Forms.Data.DataProviders.Oracle.OracleWFMDataProvider,Sitecore.Forms.Oracle">
      <param desc="connection string">user id=(user);password=(password);Data Source=(database)</param>
    </formsDataProvider>
    -->

    <!-- SQLite -->
       <!--
    <formsDataProvider type="Sitecore.Forms.Data.DataProviders.SQLite.SQLiteWFMDataProvider,Sitecore.Forms.Core">
      <param desc="connection string">Data Source=/data/sitecore_webforms.db;version=3;BinaryGUID=true</param>
    </formsDataProvider>-->


Please leave your comments or share this tip if it’s useful for you.

Monday, February 16, 2015

Metadata file 'HedgehogDevelopment.CodeGeneration.Extensions.dll' could not be found

If you are getting HedgehogDevelopment.CodeGeneration.Extensions.dll error in TDS Sitecore project then put HedgehogDevelopment.CodeGeneration.Extensions.dll into C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies folder for Visual Studio 2012.

Please leave your comments or share this tip if it’s useful for you.

Saturday, February 14, 2015

How to make URL in lower case in Sitecore

Sometimes client requirement is to make all letters lower case of their website URL. It’s a good practice as all search engine provide better result with lower case URL.

How to do it in Sitecore with .NET?

Sitecore is smartly provide this facility by changing just one entry in web.config file. If you want make URL in lower case then keep lowercaseUrls="true" from <linkManager defaultProvider="sitecore"> section in web.config file as highlighted below


    <linkManager defaultProvider="sitecore">
      <providers>
        <clear/>
        <add name="sitecore" type="Sitecore.Links.LinkProvider, Sitecore.Kernel" addAspxExtension="false" alwaysIncludeServerUrl="false" encodeNames="true" languageEmbedding="asNeeded" languageLocation="filePath" lowercaseUrls="true" shortenUrls="true" useDisplayName="false"/>
      </providers>
    </linkManager>


Woooowww. No programming required J


Please leave your comments or share this tip if it’s useful for you.

Friday, February 13, 2015

Could not load file or assembly 'System.Data.SQLite, Version=1.0.89.0, Culture=neutral, PublicKeyToken=abcdefghijkl or one of its dependencies

If you are getting Sitecore WFFM error "Could not load file or assembly 'System.Data.SQLite, Version=1.0.89.0, Culture=neutral, PublicKeyToken=abcdefghijkl or one of its dependencies. The system cannot find the file specified."

Then check existence of "System.Data.SQLite.dll" in "Website\bin" folder.
If it’s missing then paste in "Website\bin" folder.

Please leave your comments or share this tip if it’s useful for you.