九、其它话题(二) Orchard 1.4 Release Notes

What's new?

Orchard1.4 修正了一些bugs,提升了性能并增加了下面特性:

  • Autoroute: Set-up token-based patterns for your URLs.
  • Projector: 创建随意的网站内容查询,在projection pages和widgets上显示结果。
  • Fields: Orchard自带了一些新field类型:Boolean,Date/Time,Enumeration,HTML5 input,Links,Media Picker,Numeric。text field新增了 添加html的特性,arkdown and textarea 成为默认的方本框。

Breaking Changes

Orchard 1.4 移除了之前的处理URLs and titles的Route part,增加了Autoroute and Alias功能。

 

How to Reset Your Site Data

App_Data目录包含了数据库和设置文档,这个目录的内容被保护的,防止网站访问者下载。

要完全重新设置网站(销毁所有数据),可以删除本目录中的内容,重新设置Orchard,这个行为是不可恢复的,所以重要数据需要先备份。

 

Autoroute

Autoroute是Orchard1.4的新增模块,autoroute是新的附加到内容类型的Content Part,替换了Route Part,为可路由的内容类型提供更为灵活的路由模式。Autoroute提供了创建和选择自定义路由模式,在基础模式上重写,当新版本的content item保存时重新生成路由。除了在路由中指定静态值,Autoroute也影响Orchard中的tokens,允许你基于动态信息创建路由,如创建日期、用户、和其它信息,从content item 到content item 可能会不同。

Orchard1.4中Route Content Part被Autoroute和Title Parts替换了,Autoroute Part处理content item的产生路由需求,Title Part处理标题需求。

Autoroute and Title Parts in Orchard CMS

 

Autoroute part有3处必需的设置:

  • Allow Custom Patterns: 选择这个选项允许contributor当创建content item时创建内容到指定或重写route/slug的创建。contributor能指定一个与内容类型默认模式不同的模式。
  • Automatically regenerate when editing content:选择这个选项意思是当contributor更改content item时路由能改变,例如,路由模式是基于title的,contributor对content item Title更改并保存时content item的路由会改变。通常,这对SEO不是好的选择,你通常只想保持同样的路由。
  • Specifying Default and Custom Patterns:Autoroute提供默认稳定和自定义的模式,允许开发者指定基于静态信息也基于tokens如何产生内容类型的路由。

    下面是一个Blog Post的示例:

    Autoroute Blog Post in Orchard CMS

    需要注意3件事:

    • 博客文章创建者确实有能力来覆盖默认的路由模式,被称为博客和标题,当创建一个新的博客文章时,因为允许自定义模式选项被选中了。
    • 当编辑内容选项没有选择自动重新生成路由时,路由仅在首次生成,不会被Autoroute重新再生成。
    • blog post route的默认模式是基于2个tokens,the path of the container and the slug generated from the title of the blog post,这基本上就是我们现在使用的Route Part。

    为Blog Post指定自定义Autoroute模式

    如果你不喜欢blog post的默认Autoroute模式,那就更改它。下面我们基于blog post的Blog,Date Created,Title指定一个新的路由。下面是新的路由:

    {Content.Container.Path}/{Content.Date.Format:MM}/
        {Content.Date.Format:dd}/{Content.Date.Format:yyyy}/{Content.Slug}

    这个模式会产生像下面这样的路由:

    blog/12/21/2012/end-of-the-world

    为每个blog post指定这个为默认的路由

    Specify Custom Autoroute Patterns for Blog Post in Orchard CMS

     

    当blog post contributor创建一篇新博客后,他们能看到作为提示的默认模式,当允许自定义模式选项被选择上时,他们也能重这写模式。

    New Blog Post with Custom Autoroute Route in Orchard CMS

     

    允许自定义模式选项没有被选择上时,就没有textbox允许contributor输入自定义路由,Blog Post Route将仅被Autoroute产生。

    当为这个blog post输入新的title并保存时,Autoroute会根据默认模式产生一个新的路由。

    Save Orchard Blog Post with Autoroute

    posted @ 2012-03-27 15:42  commanderss  阅读(420)  评论(0编辑  收藏  举报