Blog posts by josef ottosson2021-05-29T09:56:58.0000000Z/blogs/josef-ottosson/Optimizely WorldNew major version of JOS.ContentSerializer - Version 5.0https://josef.codes/new-major-version-of-jos-contentserializer-version-5-0/2021-05-29T09:56:58.0000000ZBug fix and a breaking change in the new major version of JOS.ContentSerializer.JOS.ContentSerializer now supports TimeSpan? out of the boxhttps://josefottosson.se/jos-contentserializer-now-supports-timespan-out-of-the-box/2019-09-04T19:38:02.0000000Z<!--kg-card-begin: markdown--><p><a href="/link/dda8dd3edbaa4ce3938dc6544ae1d184.aspx">Saw the following post today</a> and decided to update <a href="https://github.com/joseftw/JOS.ContentSerializer">JOS.ContentSerializer</a> to support <code>TimeSpan?</code> properties.</p>
<p>The default implementation is really naive:</p>
<pre><code class="language-csharp">public object Handle(TimeSpan? value, PropertyInfo property, IContentData contentData)
{
return value?.ToString();
}
</code></pre>
<p>If you want to customize the behaviour, <a href="https://josefottosson.se/customizing-propertyhandlers-in-jos-contentserializer/">just follow this post</a></p>
<!--kg-card-end: markdown-->JOS.ContentSerializer now supports TimeSpan? out of the boxhttp://josefottosson.se/jos-contentserializer-now-supports-timespan-out-of-the-box/2019-09-04T17:38:02.0000000Z<!--kg-card-begin: markdown--><p><a href="/link/dda8dd3edbaa4ce3938dc6544ae1d184.aspx">Saw the following post today</a> and decided to update <a href="https://github.com/joseftw/JOS.ContentSerializer">JOS.ContentSerializer</a> to support <code>TimeSpan?</code> properties.</p>
<p>The default implementation is really naive:</p>
<pre><code class="language-csharp">public object Handle(TimeSpan? value, PropertyInfo property, IContentData contentData)
{
return value?.ToString();
}
</code></pre>
<p>If you want to customize the behaviour, <a href="https://josefottosson.se/customizing-propertyhandlers-in-jos-contentserializer/">just follow this post</a></p>
<!--kg-card-end: markdown-->JOS.ContentSerializer now supports TimeSpan? out of the boxhttps://josef.codes/jos-contentserializer-now-supports-timespan-out-of-the-box/2019-09-04T17:38:02.0000000Z<!--kg-card-begin: markdown--><p><a href="/link/dda8dd3edbaa4ce3938dc6544ae1d184.aspx">Saw the following post today</a> and decided to update <a href="https://github.com/joseftw/JOS.ContentSerializer">JOS.ContentSerializer</a> to support <code>TimeSpan?</code> properties.</p>
<p>The default implementation is really naive:</p>
<pre><code class="language-csharp">public object Handle(TimeSpan? value, PropertyInfo property, IContentData contentData)
{
return value?.ToString();
}
</code></pre>
<p>If you want to customize the behaviour, <a href="https://josefottosson.se/customizing-propertyhandlers-in-jos-contentserializer/">just follow this post</a></p>
<!--kg-card-end: markdown-->JOS.ContentSerializer now supports TimeSpan? out of the boxhttps://josef.codes/jos-contentserializer-now-supports-timespan-out-of-the-box/2019-09-04T17:38:02.0000000Z<!--kg-card-begin: markdown--><p><a href="/link/dda8dd3edbaa4ce3938dc6544ae1d184.aspx">Saw the following post today</a> and decided to update <a href="https://github.com/joseftw/JOS.ContentSerializer">JOS.ContentSerializer</a> to support <code>TimeSpan?</code> properties.</p>
<p>The default implementation is really naive:</p>
<pre><code class="language-csharp">public object Handle(TimeSpan? value, PropertyInfo property, IContentData contentData)
{
return value?.ToString();
}
</code></pre>
<p>If you want to customize the behaviour, <a href="https://josefottosson.se/customizing-propertyhandlers-in-jos-contentserializer/">just follow this post</a></p>
<!--kg-card-end: markdown-->JOS.Epi.ContentApi updated to version 3.0.0https://josefottosson.se/jos-epi-contentapi-updated-to-version-3-0-0/2018-06-05T14:10:48.0000000Z<p>Thanks to the <a href="/link/bde262b8287545f7994f7016e3841613.aspx#comment7869">discussion in the comments on the blogpost written by Johan Björnfot</a> I could simplify the code a lot and remove the HttpModule.</p>
<p>Version 3.0.0 is now available on the <a href="https://www.nuget.org/packages/JOS.Epi.ContentApi/">nuget feed</a>.</p>
<p>It's a major version bump since I removed the HttpModule, you will need to</p>JOS.Epi.ContentApi updated to version 3.0.0http://josefottosson.se/jos-epi-contentapi-updated-to-version-3-0-0/2018-06-05T12:10:48.0000000Z<!--kg-card-begin: markdown--><p>Thanks to the <a href="/link/bde262b8287545f7994f7016e3841613.aspx#comment7869">discussion in the comments on the blogpost written by Johan Björnfot</a> I could simplify the code a lot and remove the HttpModule.</p>
<p>Version 3.0.0 is now available on the <a href="https://www.nuget.org/packages/JOS.Epi.ContentApi/">nuget feed</a>.</p>
<p>It's a major version bump since I removed the HttpModule, you will need to</p>JOS.Epi.ContentApi updated to version 3.0.0https://josef.codes/jos-epi-contentapi-updated-to-version-3-0-0/2018-06-05T12:10:48.0000000Z<!--kg-card-begin: markdown--><p>Thanks to the <a href="/link/bde262b8287545f7994f7016e3841613.aspx#comment7869">discussion in the comments on the blogpost written by Johan Björnfot</a> I could simplify the code a lot and remove the HttpModule.</p>
<p>Version 3.0.0 is now available on the <a href="https://www.nuget.org/packages/JOS.Epi.ContentApi/">nuget feed</a>.</p>
<p>It's a major version bump since I removed the HttpModule, you will need to</p>Headless Episerver? Meet JOS.Epi.ContentApihttps://josefottosson.se/headless-episerver-meet-jos-epi-contentapi/2018-04-06T14:29:34.0000000Z<p>I read <a href="https://blog.mathiaskunto.com/2018/03/23/react-and-episerver-moving-to-episerver-headless-episerver-contentdeliveryapi-with-friendly-urls-quick-poc/">this blog post by Mathias Kunto</a> where he says that he will leave my beloved library behind and start using <a href="https://sdk.episerver.com/ContentDeliveryAPI/Index.html">the new Episerver Headless API</a> instead.</p>
<p>I felt like the picture above :(</p>
<p>I couldn't stand it. So, I decided to create a new library; meet <a href="https://github.com/joseftw/JOS.Epi.ContentApi"><strong>JOS.Epi.ContentApi</strong></a></p>Headless Episerver? Meet JOS.Epi.ContentApihttp://josefottosson.se/headless-episerver-meet-jos-epi-contentapi/2018-04-06T12:29:34.0000000Z<!--kg-card-begin: markdown--><p>I read <a href="https://blog.mathiaskunto.com/2018/03/23/react-and-episerver-moving-to-episerver-headless-episerver-contentdeliveryapi-with-friendly-urls-quick-poc/">this blog post by Mathias Kunto</a> where he says that he will leave my beloved library behind and start using <a href="https://sdk.episerver.com/ContentDeliveryAPI/Index.html">the new Episerver Headless API</a> instead.</p>
<p>I felt like the picture above :(</p>
<p>I couldn't stand it. So, I decided to create a new library; meet <a href="https://github.com/joseftw/JOS.Epi.ContentApi"><strong>JOS.Epi.ContentApi</strong></a></p>Headless Episerver? Meet JOS.Epi.ContentApihttps://josef.codes/headless-episerver-meet-jos-epi-contentapi/2018-04-06T12:29:34.0000000Z<!--kg-card-begin: markdown--><p>I read <a href="https://blog.mathiaskunto.com/2018/03/23/react-and-episerver-moving-to-episerver-headless-episerver-contentdeliveryapi-with-friendly-urls-quick-poc/">this blog post by Mathias Kunto</a> where he says that he will leave my beloved library behind and start using <a href="https://sdk.episerver.com/ContentDeliveryAPI/Index.html">the new Episerver Headless API</a> instead.</p>
<p>I felt like the picture above :(</p>
<p>I couldn't stand it. So, I decided to create a new library; meet <a href="https://github.com/joseftw/JOS.Epi.ContentApi"><strong>JOS.Epi.ContentApi</strong></a></p>How to configure Episerver to use Active Directoryhttps://josefottosson.se/how-to-configure-episerver-to-use-active-directory/2018-03-14T16:33:25.0000000Z<p>This is a quick guide showing how to configure Episerver to use Active Directory instead of <code>Multiplexing/WindowsProvider</code>. This is NOT showing how to use Azure AD. <br />
Im testing this on a new Alloy site running Episerver <code>11.3.1</code>.</p>
<p>NOTE, while this is a quick way of adding Active</p>How to configure Episerver to use Active Directoryhttp://josefottosson.se/how-to-configure-episerver-to-use-active-directory/2018-03-14T15:33:25.0000000Z<!--kg-card-begin: markdown--><p>This is a quick guide showing how to configure Episerver to use Active Directory instead of <code>Multiplexing/WindowsProvider</code>. This is NOT showing how to use Azure AD.<br />
Im testing this on a new Alloy site running Episerver <code>11.3.1</code>.</p>
<p>NOTE, while this is a quick way of adding Active</p>How to configure Episerver to use Active Directoryhttps://josef.codes/how-to-configure-episerver-to-use-active-directory/2018-03-14T15:33:25.0000000Z<!--kg-card-begin: markdown--><p>This is a quick guide showing how to configure Episerver to use Active Directory instead of <code>Multiplexing/WindowsProvider</code>. This is NOT showing how to use Azure AD.<br />
Im testing this on a new Alloy site running Episerver <code>11.3.1</code>.</p>
<p>NOTE, while this is a quick way of adding Active</p>Customizing PropertyHandlers in JOS.ContentSerializerhttps://josefottosson.se/customizing-propertyhandlers-in-jos-contentserializer/2018-01-25T09:51:43.0000000ZShows how to easily replace a built in PropertyHandler.Customizing PropertyHandlers in JOS.ContentSerializerhttp://josefottosson.se/customizing-propertyhandlers-in-jos-contentserializer/2018-01-25T08:51:43.0000000ZShows how to easily replace a built in PropertyHandler.JOS.ContentSerializer 3.0 has been released!https://josefottosson.se/jos-contentserializer-3-0-has-been-released/2017-12-29T18:34:07.0000000Z<h2 id="newfeatures">New features</h2>
<h4 id="supportformorebuiltinproperties">Support for more built in properties</h4>
<p>The following properties are now supported out of the box:</p>
<ul>
<li><code>BlockData</code></li>
<li><code>bool</code></li>
<li><code>double</code></li>
<li><code>ContentArea</code></li>
<li><code>ContentReference</code></li>
<li><code>DateTime</code></li>
<li><code>IEnumerable<ContentReference></code></li>
<li><code>int</code></li>
<li><code>LinkItemCollection</code></li>
<li><code>PageReference</code></li>
<li><code>PageType</code></li>
<li><code>string[]</code></li>
<li><code>string</code> <em>SelectOne/SelectMany</em> support.</li>
<li><code>Url</code></li>
<li><code>XhtmlString</code></li>
<li><strong>NEW <code>IEnumerable<string></code></strong> <em>ICollection/IList works as well</em></li>
<li><strong>NEW</strong></li></ul>JOS.ContentSerializer now supports Episerver 11https://josefottosson.se/jos-contentserializer-now-supports-episerver-11/2017-11-24T18:43:31.0000000Z<p>I've just pushed version <strong>2.0.0</strong> to the nuget feed. <br />
The following breaking changes was introduced:</p>
<ul>
<li>Target framework is now set to 4.6.1<a href="/link/fe81cfd67cfd4ee79c862a762311dc6b.aspx">(same as Epi)</a></li>
<li>Minimum version 11.1.0 of EPiServer.CMS.UI.Core is required.</li>
</ul>
<p>I've only tested it with an manually upgraded Alloy</p>JOS.ContentJson gets replaced by JOS.ContentSerializerhttps://josefottosson.se/jos-contentjson-gets-replaced-by-jos-contentserializer/2017-05-21T21:09:58.0000000ZJOS.ContentJson gets replaced by JOS.ContentSerializer. Fun fun fun!Custom Episerver routes without querystring - IPartialRouterhttps://josefottosson.se/custom-episerver-routes-without-querystring-ipartialrouter/2017-04-18T21:41:48.0000000Z<p>I will show you how to easily bind parameters to your action methods without using the querystring.</p>
<p>I have a page, <code>MyPage</code>, with a controller that looks like this:</p>
<pre><code class="language-csharp">public async Task<ActionResult> Index(MyPage currentPage, int myId)
{
var response = await this.thirdPartyApi.Get(myId);
// Do something with</code></pre>