How do you force WeBlog to reorder blog posts into new folder structure? - sitecore

The base WeBlog config contains these nodes:
<event name="item:saved">
<handler type="Sitecore.Sharedsource.Tasks.NewsMover, Sitecore.Sharedsource.NewsMover" method="OnItemSaved">
<database>master</database>
<templates hint="raw:AddTemplateConfiguration">
<template id="Modules/WeBlog/BlogEntry" sort="Descending">
<DateField>Entry Date</DateField>
<YearTemplate formatString="yyyy">Common/Folder</YearTemplate>
<MonthTemplate formatString="MMMM">Common/Folder</MonthTemplate>
<!-- Uncomment the following line if you have too many posts per month (more than 100) -->
<!--<DayTemplate formatString="dd">Common/Folder</DayTemplate>-->
</template>
</templates>
</handler>
<!-- Keep the post and comment handlers seperate to ensure comments are structured below posts and not within the same folder structure as posts -->
<handler type="Sitecore.Sharedsource.Tasks.NewsMover, Sitecore.Sharedsource.NewsMover" method="OnItemSaved" use="comments">
<database>master</database>
<templates hint="raw:AddTemplateConfiguration">
<template id="Modules/WeBlog/BlogComment" sort="Descending">
<DateField>__created</DateField>
<YearTemplate formatString="yyyy">Common/Folder</YearTemplate>
<MonthTemplate formatString="MMMM">Common/Folder</MonthTemplate>
<!-- Uncomment the following line if you have too many posts per month (more than 100) -->
<!--<DayTemplate formatString="dd">Common/Folder</DayTemplate>-->
</template>
</templates>
</handler>
<handler type="Sitecore.Modules.WeBlog.Globalization.ItemAndPublishEventHandler, Sitecore.Modules.WeBlog" method="OnItemSaved"/>
</event>
If the line below is uncommented for BlogEntries, how do you force WeBlog to reorder the existing blog posts into the correct folders (now containing a day folder)?
<DayTemplate formatString="dd">Common/Folder</DayTemplate>
Currently using Sitecore 7.1 and WeBlog 5.3.

Related

how can I deeplink an app from Google Assistant?

I'm creating a dialogflow agent integrated with Google Assistant.
What I'd like to do is to open an app (my app) when a proper intent is matched. I've seen that actions like Youtube, Spotify etc. are able to do that, for example I can tell the Youtube action "search for cats video" and the Youtube app will open with a list of cats videos.
I tried to use the DeepLink class but I then noticed it's deprecated.
DeepLink class
Is there any way you can suggest me to do this?
Thanks in advance
I think you are looking for App Actions. Here are the steps you need to follow:
Find the right built-in intent. actions.intent.OPEN_APP_FEATURE should be the right one for you.
Create and update actions.xml. It should look like
<?xml version="1.0" encoding="UTF-8"?>
<!-- This is a sample actions.xml -->
<actions>
<action intentName="actions.intent.OPEN_APP_FEATURE">
<!-- Use url from inventory match for deep link fulfillment -->
<fulfillment urlTemplate="{#url}" />
<!-- Define parameters with inventories here -->
<parameter name="feature">
<entity-set-reference entitySetId="featureParamEntitySet" />
</parameter>
</action>
<entity-set entitySetId="featureParamEntitySet">
<!-- Provide a URL per entity -->
<entity url="myapp://deeplink/one" name="featureParam_one" alternateName="#array/featureParam_one_synonyms" />
<entity url="myapp://deeplink/two" name="featureParam_two" alternateName="#array/featureParam_two_synonyms" />
</entity-set>
</actions>

Sitecore 8.1 Upgrade Media section broken

I upgraded sitecore from 7.0 to 8.1. The only real problem I have ran into is the media section is broken and the images appear broken on the site itself.
The weird part and I can upload and download the media items. It is broken in both chrome and firefox.
Thanks]1
Update
<encodeNameReplacements>
<replace mode="on" find="&" replaceWith=",-a-," />
<replace mode="on" find="?" replaceWith=",-q-," />
<replace mode="on" find="/" replaceWith=",-s-," />
<replace mode="on" find="*" replaceWith=",-w-," />
<replace mode="on" find="." replaceWith=",-d-," />
<replace mode="on" find=":" replaceWith=",-c-," />
</encodeNameReplacements>
It looks like a problem with Sitecore Media Protection (included first time in Sitecore 7.5).
You can read more about it in Adam blog post "Do not turn Sitecore Media Request protection off and protect older Sitecore versions with ImageGuard".
But I don't know why hashes are not added to the links in Sitecore. It should be disabled for the Sitecore internal sites (e.g. shell, login, etc).
Try to disable media protection by changing the config in /App_config/Include/Sitecore.Media.RequestProtection.config file and see if this is the reason of your problems.
Fixed it. It turns out the way sitecore is configured has changed a lot between 7-8.1. By adding
<sitecore configSource="App_Config\Sitecore.config" />
and removing the old section fixed the problem.
You are missing a replacement:
<replace mode="on" find=" " replaceWith="-" />
It can cause problems in images request, if you are using spaces in media item names.
Add it to your section
Another thing to see is if your CustomHandler section is like this:
<customHandlers>
<handler trigger="-/media/" handler="sitecore_media.ashx" />
<handler trigger="~/media/" handler="sitecore_media.ashx" />
<handler trigger="~/api/" handler="sitecore_api.ashx" />
<handler trigger="~/xaml/" handler="sitecore_xaml.ashx" />
<handler trigger="~/icon/" handler="sitecore_icon.ashx" />
<handler trigger="~/feed/" handler="sitecore_feed.ashx" />
</customHandlers>
This is the same of "Configuration Files Changes" especified by Sitecore Upgrade 8.1 IR
One of the new changes in 8.1 is the change of the default prefix from "~" to "-". It could be related to this prefix change. If you take the URLs that are getting a 404 and replace the ~ with a -, do the URLs to media work?

SitecoreSearchContrib - How to merge & sort from multiple indexes

I'm currently setting up a search for a Sitecore 6.6 web site using SitecoreSearchContrib.
I've got two indexes.
One index looking at my web site content:
/sitecore/content/home
and another index looking in a documents folder in the media library (which contains PDF etc).
/sitecore/media library/documents
The search on my web site can return web pages or Word/PDF documents.
Is there a way (beside using one super-index for content & media library) that I can combine the results from both indexes and still order them by their relevance / hit count?
Ended up solving this by getting rid of the second index and instead, simply included an additional <locations>...</locations> block in the scSearchContrib.Crawler.config to point to the folder in the media library where my documents live.
E.g.
Inside of App_Config/Include/scSearchContrib.Crawler.config
......
<index id="web" type="Sitecore.Search.Index, Sitecore.Kernel">
<param desc="name">$(id)</param>
<param desc="folder">web</param>
<Analyzer ref="search/analyzer" />
<locations hint="list:AddCrawler">
<my-site-content type="scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler,scSearchContrib.Crawler">
<Database>web</Database>
<Root>/sitecore/content/MySite/Home</Root>
<tags>Web Content</tags>
<IndexAllFields>true</IndexAllFields>
<!-- Include/Exclude templates, crawlers etc here -->
</locations>
<locations hint="list:AddCrawler">
<my-site-media-library type="scSearchContrib.Crawler.Crawlers.AdvancedDatabaseCrawler,scSearchContrib.Crawler">
<Database>web</Database>
<Root>/sitecore/media library/SomeFolder/Documents</Root>
<tags>Documents</tags>
<IndexAllFields>true</IndexAllFields>
<!-- Include/Exclude templates, crawlers etc here -->
</locations>
</index>
......

ASP.Net login control will not work with Intelligencia.UrlRewriter

I hope someone can help me shed some light on this nightmare I'm having...!
I have just complete an ASP.Net e-commerce website with the help of an Apress book; The BalloonShop project, some of you might already know the one.
Everything is fine and dandy apart from one niggle that I cant seen to sort out!
I cannot logout from my site using the asp.net login control from any page that does not have the .aspx extension in the Url. This is namely; Departments, Category and Products as these are using the Intelligencia.UrlRewriter to provide browser friendly url's.
My url's are rewritten perfectly, but when I try to logout from a page that is using the url rewriter it does not work, and I receive the following message in my error log email:
Exception generated on 22 February 2013, at 22:23
Page location: /Triple-x/Dynamo-p4/?
<div id=":143">ProductId=4
Message: The HTTP verb POST used to access path '/Triple-x/Dynamo-p4/' is not allowed.
Source: System.Web
Method: System.IAsyncResult BeginProcessRequest(System.Web.HttpContext, System.AsyncCallback, System.Object)
Stack Trace:
at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionSt ep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)</div>
In my web.config if have:
<configSections>
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler,Intelligencia.UrlRewriter" />
</configSections>
<rewriter>
<!-- Rewrite department pages -->
<rewrite url="^.*-d([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1" processing="stop" />
<rewrite url="^.*-d([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentID=$1&Page=$2" processing="stop" />
<!-- Rewrite category pages -->
<rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2" processing="stop" />
<rewrite url="^.*-d([0-9]+)/.*-c([0-9]+)/page-([0-9]+)/?$" to="~/Catalog.aspx?DepartmentId=$1&CategoryId=$2&Page=$3" processing="stop" />
<!-- Rewrite product details pages -->
<rewrite url="^.*-p([0-9]+)/?$" to="~/Product.aspx?ProductId=$1" processing="stop" />
</rewriter>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
<remove name="ScriptModule" />
<!--<add name="ScriptModule" preCondition="managedHandler" />-->
</modules>
</system.webServer>
I am also using IIS7 on my local machine, and have read that this can sometimes be the cause re: AppPool version. I have tried changing this to Classic ASP as suggested, but this did not work for me!
Does anyone know if this is a common problem when hosting on local machine and using Intelligencia.UrlRewriter? Would this possibly not be an issue if hosting on a shared web hosting server?
If I'm way off the mark then please forgive my naivety, as I am still quite new to this, especially projects of this size.
Thanks for you help!!
If you want to use url rooting you can use this codes. I use it also an e-commerce project:
in Global.asax file :
void Application_Start(object sender, EventArgs e)
{
if (RouteTable.Routes.Count <= 0)
{
RouteTable.Routes.Add("Urun", new Route("Urun/{category}/{name}/{prid}/{caid}", new PageRouteHandler("~/ProductDetail.aspx")));
RouteTable.Routes.Add("Kategori", new Route("Kategori/{upper}/{name}/{caid}", new PageRouteHandler("~/Categories.aspx")));
RouteTable.Routes.Add("Icerik", new Route("Icerik/{name}/{cpid}", new PageRouteHandler("~/ContentPage.aspx")));
}
}
And you can this codes wherever you want to give link:
var param = new RouteValueDictionary
{
{"category", "Oyuncak"},
{"prid", ((DiscountProductsResult) e.Item.DataItem).ProductId},
{"name", ((DiscountProductsResult) e.Item.DataItem).UrlView.Replace(" ", "-")},
{"caid", 0}
};
VirtualPathData path = RouteTable.Routes.GetVirtualPath(null, "Urun", param);
And you can get querystring values like this:
RouteData.Values["caid"]

magento - where to put templates

I am following the Alan Storm Magento tutorials
http://alanstorm.com/layouts_blocks_and_templates
In this tutorial he suggests creating an html template file at this location
app/design/frontend/base/default/template/simple_page.phtml
However templates look like they are grouped into additional directories by module name. Is this the current standard?
I am using Magento 1.6.2. I am not sure what version the tutorial is tested for.
* additional information *
I created a file called "local.xml" at this location
app/design/frontend/base/default/layout/local.xml
that contains:
<layout version="0.1.0">
<default>
<reference name="root">
<block type="page/html" name="root" output="toHtml" template="simple_page.phtml" />
</reference>
</default>
</layout>
then file "simple_page.phtml" in directory:
app/design/frontend/base/default/template/
that contains:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<p>hello world</p>
</body>
</html>
After clearing cache, I get "white screen of death" on home page, however helloworld page works.
If I erase local.xml, front page comes back.
Here is a short Turorial but the main concept is that you make your own theme/template and overwrite the default templates.
So you can create under System -> configuration -> Design under the point Theme you change the default to your own theme name like "my_theme".
Rest you can see in the tutorial. You can put a folder with your theme name to
app\code\frontend\default\my_theme
Then you can copy the template from default with the same folder structure to your theme and magento take the template from your theme folder instead the default template.
Keep reading the tutorial...
http://alanstorm.com/layouts_blocks_and_templates
"If you go to any other page in your Magento site, you’ll notice
they’re either blank white, or have the same red background that your
hello world page does. Let’s change your local.xml file so it only
applies to the hello world page. We’ll do this by changing default to
use the full action name handle (helloworldindexindex)."
<layout version="0.1.0">
<helloworld_index_index>
<reference name="root">
<block type="page/html" name="root" output="toHtml" template="simple_page.phtml" />
</reference>
</helloworld_index_index>
</layout>