<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://www.danbrendstrup.dk/</id>
  <title>Feed for danbrendstrup.dk</title>
  <updated>2011-06-14T22:00:00Z</updated>
  <link rel="alternate" href="http://www.danbrendstrup.dk/"/>
  <link rel="self" href="http://www.danbrendstrup.dk/atom.xml"/>
  <author>
    <name>Dan Brendstrup</name>
    <uri>http://www.danbrendstrup.dk</uri>
  </author>
  <entry>
    <id>tag:www.danbrendstrup.dk,2011-06-15:/2011/06/15/mvc-introduction.html</id>
    <title type="html">Introduction to MVC at Umbraco Codegarden 2011</title>
    <published>2011-06-14T22:00:00Z</published>
    <updated>2011-06-15T12:14:18Z</updated>
    <link rel="alternate" href="http://www.danbrendstrup.dk/2011/06/15/mvc-introduction.html"/>
    <content type="html">&lt;p&gt;The next version of Umbraco (version 5) was &lt;a href="http://umbraco.codeplex.com/releases/view/68327"&gt;released in a
Community Technology Preview today&lt;/a&gt;. It is essentially a complete rewrite of the
Umbraco codebase to move it from classic ASP.NET to &lt;a href="http://asp.net/mvc"&gt;ASP.NET
MVC&lt;/a&gt;. To get the community up to speed,
&lt;a href="http://apowell.me"&gt;Aaron Powell&lt;/a&gt; (&lt;a href="http://www.twitter.com/#!/slace"&gt;@slace&lt;/a&gt;) took a full room of conference attendees through a live-coding preview of basic MVC development.&lt;/p&gt;

&lt;p&gt;The basics of the &lt;a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller"&gt;Model-View-Controller pattern&lt;/a&gt; have been around for
a while, but Aaron's description based on an Umbraco context was the
following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A model is a set of data that you pass to a view.&lt;/li&gt;
&lt;li&gt;A view is the UI which displays the content of the model. It has no functionality except manipulating the UI, much like current templates and macros in Umbraco.&lt;/li&gt;
&lt;li&gt;The controller is the brain, which contains the actual functionality. It constructs a model, picks a view and transfers data.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;As with so many other things, Microsoft is late to the party and have found &lt;a href="http://rubyonrails.org/"&gt;sholders to stand on&lt;/a&gt; and cowpaths to walk, but a good thing is a good thing and there is much to like about this approach for developers. For those of us that focus on frontend development, these were a couple of the key takeaways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;MVC strives for pretty URLs, and by
default will not append file endings to URLs. So thankfully there'll be
no more out-of-the-box ".aspx" to turn off. It does however appear that
it still prefers to use capitalized words in URLs, so keep an eye out
for that if that gives you tics.&lt;/li&gt;
&lt;li&gt;The .NET heads have clearly decided that &lt;a href="http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx"&gt;Razor&lt;/a&gt; is the new black for
markup templating, but ASP.NET MVC includes markup scaffolding, so
you'll probably want to read up on &lt;a href="http://channel9.msdn.com/Events/MIX/MIX11/FRM13"&gt;how to customize this&lt;/a&gt;, as
it has never been a good idea to trust a Microsoft platform to generate your markup, render your webpages or babysit your kids. I've got my fingers crossed that Umbraco 5 will still support XSLT for
those of us who care about our markup &#8212; and I'm hoping to have this hope
confirmed during &lt;a href="http://codegarden11.com/sessions.aspx"&gt;the rest of the Codegarden sessions&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

</content>
    <summary type="html">Aaron Powell does a live-coding introduction to ASP.NET MVC, used in the upcoming Umbraco 5</summary>
  </entry>
  <entry>
    <id>tag:www.danbrendstrup.dk,2011-06-08:/2011/06/08/easy-meta-tags-for-umbraco.html</id>
    <title type="html">Easy meta tags for Umbraco sites</title>
    <published>2011-06-07T22:00:00Z</published>
    <updated>2011-06-14T22:12:45Z</updated>
    <link rel="alternate" href="http://www.danbrendstrup.dk/2011/06/08/easy-meta-tags-for-umbraco.html"/>
    <content type="html">&lt;p&gt;Meta keywords and meta description tags are easy to add to an Umbraco
site. Simply add a Textstring and a Textbox multiple to a document type
and output them in &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; tags on the site, and you're good to go.&lt;/p&gt;

&lt;p&gt;What's difficult about meta tags is the amount of work it requires of
website editors to give them meaningful content. They might not be all
that important for search engines any more, but everyone still agrees
that well-structured metadata tags belong in a semantically marked up web
document. So we need to help out the editors.&lt;/p&gt;

&lt;p&gt;A website is a hierarchy of pages, and it is a reasonable assumption
that a good description of any given page will also be a serviceable
description of any of its subpages. A good &lt;code&gt;&amp;lt;meta
name='description'/&amp;gt;&lt;/code&gt; on the &lt;em&gt;Projects&lt;/em&gt; page could also serve as a
description on any page underneath it, describing a specific project. So
what we need is to create our &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; tags in such a way that if they are
not defined for a given page, they will be inherited from the nearest
ancestor in the page hiearchy that has such tags defined.&lt;/p&gt;

&lt;p&gt;Thankfully this is trivial with the help of XSLT and XPath. Within the
macro that renders the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; content for you Umbraco site, add the
following tags:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;meta name="keywords" content="{$currentPage/ancestor-or-self::* [metaKeywords != ''][1]/metaKeywords}"/&amp;gt;
&amp;lt;meta name="description" content="{$currentPage/ancestor-or-self::* [metaDescription != ''][1]/metaDescription}"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Provided that your document properties have the aliases &lt;code&gt;metaKeywords&lt;/code&gt; and
&lt;code&gt;metaDescription&lt;/code&gt;, respectively, this will search upwards through the
page hierarchy to find the nearest ancestor with content for each of
these fields and use that content for the current page. If content is
defined for the current page, that will of course be used.&lt;/p&gt;

&lt;p&gt;Naturally, it is still preferable to enter accurate keywords and
descriptive text for every singe page on a site, but when that is not
feasible, this method is an easy way to ensure usefully  descriptive
&lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; tags on every page.&lt;/p&gt;
</content>
    <summary type="html">XSLT makes it easy to create meta tags that trickle down to subpages</summary>
  </entry>
</feed>

