Sunday, 8 July 2018

Sitecore image getting black border on top and bottom?

Sometimes it happens that you may be getting black border on top and bottom of  an sitecore image item.

This is because of different height/width of original image. By default you will get black colour on top and bottom of an image.
There is setting for this in sitecore.config
Inside config you will get this below settings
<!--  MEDIA - DEFAULT IMAGE BACKGROUND COLOR
           The default background color for dynamically resizing images to different aspect ratios than the originals.



           Sitecore applies this background color only for image types that do not support transparency (image/jpeg, image/gif and image/bmp).
           When resizing any other image types (including image/png), Sitecore always applies a transparent background.
           You can specify a color name (such as Black or Red) or a hex color code (such as #CE55E2).
           If you specify no value, Sitecore applies a black background color when resizing such images.
           Default value: ""
     -->
       <setting name="Media.DefaultImageBackgroundColor" value="" />

By default value is empty and that's why you are getting black colour. So you can change color by setting value.

Thursday, 28 June 2018

Sitecore Alias Item?

What is Alias Item in Sitecore?

Alternative name for any page item. Like for a site, user wanted to browse page as sample. And from sitecore CMS as a developer created sample alias which will linked to Home Item.

So when sample page will be browsed, it will open home item of site.

By default Alias item are for Single language. At the time of creating alias, put the language name in field Linked Language.


How to create Alias Item in Sitecore?

To create alias item, Go to Sitecore/System tree and under the alias folder will create alias items. Below is the screenshot for path.


sitecore-alias-item


Some time created alias are not working, in this case find below setting

<setting name="AliasesActive" value="true" />

How to Retrieve all created Alias items using DB query?

By default all the Alias items are stored in Items Table.

SELECT * FROM [dbo].[Items]