Improving productivity – Part 1 of X

Yes, I start this post with Part 1 of X. A lot of you guys have noticed that I’m not that good at finishing blogseries. I guess that’s the result of trying always be one step ahead. you forget what’s ahead ;-).

Well back to the subject again: productivity. For a long time I’m noticing that a lot of colleagues are writing and rewriting the same code on daily base. Not because it’s not efficient enough, but just because it’s another (new) customer or it’s a slightly different implementation of the same stuff. I really hate it when I’ve to rewrite my own work over and over. Mostly because our (X)HTML and CSS-guru’s and even designers are reusing lots of their ideas and products. For example, a Sitemap stays a Sitemap, a navigation stays a navigation and even lists with paging(such as search results and category lists) have the same layout or at least the same (X)HTML. I want to get right of changing my code for a single CSS-class or even rewriting my whole sitemap.xslt or .cs.

For a while now I’m studying on the best way to work with ASP.NET. A part of this study became a closer integration with Sitecore. 2 weeks ago, I reached finally decided to publish my work it as an Add-on to Sitecore. It will be a bigger product then just the some webcontrols, but later more on the absolute goals of the project and the final product. First some results. So here’s the code you will use in the near future for creating a Sitemap or a BreadCrumb:

<asp:SiteMapDataSource ID=”SiteMapDataSource1″ runat=”server” />
<asp:TreeView ID=”tvSitemap” runat=”server” DataSourceID=”SiteMapDataSource1″ />
<asp:SiteMapPath ID=”smpBreadCrumb” runat=”server” />

That can’t be true, can you believe it ;-)? Well I do!
Ofcourse there’s some additional configuration need. In this case we’ve to update the web.config. I’ve written a SiteMapProvider for Sitecore. And it seems to perform as well. So to the Web.config, how does it look like?

    <!– SiteMap Provider Configuration –>

    <siteMap enabled=true defaultProvider=SitecoreSiteMapProvider>

      <providers>

        <add name=SitecoreSiteMapProvider

            type=Sitecore.Web.SitecoreTreeSiteMapProvider

            site=Website

        />

      </providers>

    </siteMap>

I think you can live with that amount of rules don’t you? Of course, you’ve to add your own CssClasses. And you’re properly a bit worried about the produced (X)HTML, but don’t worry, the package will include some Adapters as well, so your Sitemap will be rendered in a real Web 2.0 way :D.
As you can see you’ve to configure the website, this needs to be done, so the Sitemap isn’t going to cache the whole database. The cache will be flushed every single publish action. So it uses all the right data at anytime.

By now, I’m refactoring my solution for another type of Sitemap. I’ll come back on that in a later entry. The Current TreeSiteMap also misses some extensibility as you are used to. The following 3 features need to be completed, but have to wait till I’ve finished my refactoring(some Base-classes so the further development and creating of your own SiteMapProviders will be very easy).

  1. By now I’m using the Item.DisplayName, I will give you the possibility to override my ‘string GetTitle(Item itemNode)’ in the web.config
  2. Same goes out to the used URL.
  3. StartPath can be defined in the future.

When will all of this be released? Hmmm… Hopefully it will be ready for some alpha testing by the end of September. Some of the chaps around Sitemap already have an old build to play with, but the code is dramatically under development and testing, so you can’t even talk about a pre-alpha.

For now, enjoy coding and have a good weekend!

One thought on “Improving productivity – Part 1 of X”

Comments are closed.