PowerShell ISE in Sitecore to populate data in your meta tags

Hello guys,

Today I wrote my first PowerShell script and it felt amazing. The power of this module in Sitecore is pure genius. It lets you handle large bulk updates in the matter of seconds.

One of our requirements was to complete the Meta Tags of the entire website.

If you can imagine to go page by page it could take a day or more for one person and the risk of doing something wrong increases with the page number.

Luckily we have PowerShell ISE and it works like a charm.

<$homeItem = Get-Item -Path 'master:\content\home'       $allPagesThatHaveMetaTags = $homeItem | Get-ChildItem -recurse | Where-Object {$_.MetaDescription -ne $null }

In the allPagesThatHaveMetaTags we have all items that contain the field the MetaDescription.

Now it a foreach we can go item by item and update the MetaDescription field:

$allPagesThatHaveMetaTags | ForEach-Object {
$pageDescription = 'default meta tag description in case of no article body'
$metaDescriptionItem = 'default text'                                
if($_["Text"] -ne $null -and $_["Text"] -ne '')
{
$pageDescription = $_["Text"];
$metaDescriptionItem = 'Text field on the same item';
}

$_.Editing.BeginEdit()
$_["MetaDescription"] = $pageDescription
$_.Editing.EndEdit()

Write-Host 'Item with name ' + $_.Name + 'and ID' + $_.ID + 'has been updated with metadescription from ' + $metaDescriptionItem
}

Whith the &metaDescriptionItem I am creating a log list so I can know which items have default description and which have from the TEXT field.

Regards,

VP

 

“Add to home screen” website image

Hi guys,

A cool thing you can do with your website is to set the links which appear as shortcuts on your iPhone or iPad when you press “Add to home screen”.

This is a very cool feature if you have responsive design websites that people use constantly from devices.

Yes Apple is awesome. 🙂

Requirements: I would like to be able to change the images that appear when I use the feature “Add to home screen” my website on apple devices.

Continue reading