Pages

19 March, 2012

Wildcard Module is not working for newly created page in Sitecore – 9

Wildcard Module allows us to work with Dynamic URL and Sitecore wildcard items.

Problem: In Sitecore instance, Wildcard module was working for a page when we initially configured for the first time. When we deleted that page and recreated that page again, wildcard module was not working. And it was not working for the newly created page in Sitecore. In Code-behind, it was not able to match the tokens in the particular URL.


Solution: In Sitecore \System\Modules\Wildcards\Routes\<BlogRoute>, we need to add items to create the rule for wildcard replacement. In that, we will be adding the pages to which wildcard to apply.
When we add pages to Data Items, wildcard module will replace with tokens only to pages which match this Items Collection (GUIDs). So in order to use this wildcard route in other page or newly created page, we need to add the page explicitly in this data items as shown in below diagram.
By doing this, Sitecore Wildcard module started to work for newly created page.


For every newly created page, we cannot add the page to this Item collection automatically. If someone finds the solution to resolve this issue, it would be a great help. !!!

16 March, 2012

How to use extension in the Sitecore Media Request URL – 8

Go to Web.config file and find a setting named “Media.RequestExtension” and remove the extension value.
<!--  MEDIA - REQUEST EXTENSION                
The extension to use in media request URLs. If the value is not set, the Extension field of the individual media items will be used (ie. JPG, GIF, etc.)
Default value: "ashx"-->
      <setting name="Media.RequestExtension" value="ashx" />

Remove ashx from the value.
      <setting name="Media.RequestExtension" value="" />


Sample:
Before change      : /~/media/Images/logo.ashx
After change         : /~/media/Images/logo.png (ashx also will work.)



How to allow dots(.) in Sitecore Item names – 7

Go to Web.config file and find a setting named “ItemNameValidation” and change the validation to allow dots. 
      <!--  ITEM NAME VALIDATION
            Regular expression for validating item names   -->
      <setting name="ItemNameValidation" value="^[\w\*\$][\w\s\-\$]*(\(\d{1,}\)){0,1}$" />
Modified Regular Expression.
      <setting name="ItemNameValidation" value="^[\w\*\$][\w\.\s\-\$]*(\(\d{1,}\)){0,1}$" /> 


blockquote { margin: 0; } blockquote p { padding: 15px; background: #eee; border-radius: 5px; } blockquote p::before { content: '\201C'; } blockquote p::after { content: '\201D'; }