Monday, 23 January 2017

Search not working properly SharePoint 2013

Hi,
 Last week I faced an issue and wanted to share the solution with u guys. I was using content search webpart to pull data from some pages and display. The issue I faced was the page content coming from the source site was displayed two times in our content search webpart configured page. After couple of hours of investigating the Query builder, search results, content sources, etc.. we found the setting that has to be done on the source site pages.



That setting is "hide physical urls from search". This is found in "Edit Properties" of every page. Hope this helps you :)

Friday, 6 January 2017

Create Publishing Page using Custom PageLayout by PowerShell in SharePoint 2013

Hi - Today i will share the code for creating Publishing Page based on a custom Pagelayout using powershell


$siteUrl="ur site URL here"

$site = Get-spsite $siteUrl
$web = $site.OpenWeb()
$pubWeb =[Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
#Name of the page layout. It can also be your custom template
$pl = $pubWeb.GetAvailablePageLayouts() | Where { $_.Name -eq "BlankWebPartPage.aspx" }
$newPage = $pubWeb.AddPublishingPage("newpage.aspx", $pl)
$newPage.CheckIn("")
$newPage.ListItem.File.Publish("")
$web.Dispose()

Happy coding..