Custom urls with Umbraco - umbraco

I am creating a blog made with Umbraco 6 and I'd like to customize the urls.
When I create a blog post, the post is organized with the year/month/day structure and the url for post is blog.com/2013/2/19/title.aspx.
I'd like to keep the folder organization, but I'd like to change the url to blog.com/title.aspx
Is that possible? How can I do that?

One approach would be to use the umbracoUrlAlias property. On publish you could set the umbracoUrlAlias to the title. You may want to include some logic that ensures that the url is unique. You will also have to revise your navigation macros to use umbracoUrlAlias if there is one present instead of the NiceUrl.

Related

User created custom URL with Rails 4

On our website, I'd like users to be able to create their own vanity/custom URL for marketing purposes (i.e. www.website.com/cakeparty2015 actually goes to www.website.com/cake/party-supplies/2015-inventory).
This is NOT a custom user created page - it's an already existing page that it will route to. The only new information is the custom URL.
I don't really know if this is possible, but does anyone know of a way using Rails to have it so a user can log in and create their own vanity URL, say where it links, and then have that automatically re-route?
To be a little clearer - hopefully
I'd like a user to fill out a form containing:
Vanity URL -
Actual URL -
and when they submit this form, the newly created vanity URL links to the actual URL. I'd like to do this without having to put every single custom URL in my route file.
Perhaps I am looking at this wrong. I'm currently trying to figure out a way to do this with URL shortening possibly?
You probably want to use https://github.com/norman/friendly_id.
You will then have a slug field in the model and you can let your users change it.

Rails routing, deep nesting for external resources

I understand that it's a good practice to only include in the URL the parameters needed to determine the object of the model.
If I have 2 models, Post and Comment... a Post has many comments and a comment belongs to one post. A URL for a comment can be
/comment/:comment_id
and from associations I can determine which Post it belongs to but
Some rails apps need to access external resources(Via APIs for example). If the rails app needs to replicate a part of another external source, what is the right way to handle URLs and routing?
If for example a post has some comments, The URL for a comment can be
/post/:post_id/comment/:comment_id
or
/comment/:comment_id
The latter has one disadvantage which is that I can't determine which post it belongs to if the API of the external source doesn't determine that and this would cause some problems with navigation through the app but it's a short URL and allows the user to easily manipulate the URL to get another comment(which I see as an advantage). At the same time using the first(long) link would make the URL so long but I can know which post it belongs to.
The only solution I can think of is to make both possible but the user would never know that the short one exists if I make the long one the default. What do you think?
I always use the longer / spelled-out version myself. I don't mind that it's long and I can only see good things come from it as you're discovering here. I also think it's an advantage because then you can do things like this:
post = Post.find_by_id(params[:post_id])
comment = post.comments.find_by_id(params[:id])
The point being that you can't go "comment fishing" this way. You have to have the right post context in order to get at a specific comment. This may not matter a whole lot if comments aren't at all sensitive, but there are many thing in a web app that may be. So scoping finds by a root object (like post here) allows a quick permissions check that can be reused and without having to check on parent objects.
Anyway, that's my 2 cents. I never understood why people take offense to the longer urls. If they work for you then don't be afraid to use them!

Extending Blogpost Contenttype in Sharepoint 2007

Has anybody ever used blogpost contenttype and extended it and added some column to it. I know we can add columns to it using the GUI (List Setting).
Can we do this declaratively and add it to the portal using feature, so that we can create a deployable solution.
Paddy
I have not tried this, but I don't see any reason why you couldn't. The only thing that gives me pause is that Blogs are a little different than most lists because the List Definition is not in a Feature but is rather part of the Site Definition. You could create a Feature with your custom Content Type and staple it to BLOG#1. However, you will still need something (probably a Feature Receiver) that will modify the instance of the Posts lists by adding your custom columns and associating your custom Content Type.

Disable link if user is not allowed to access target

I have created an ASP.NET MVC application and created different kind of roles for my users. I have then created different kinds of AuthorizeAttributes for allowing/disallowing access to different Actions in my controls.
However I have got a lot of links that points to different of theese actions that are restricted for different roles. Can you somehow fix so that theese links get disabled automatically? I could of course add a lot of UserIsInRole(....)-stuff in my code but I really would prefer not to if there is a better way.
Du you have any suggestions?
Are they in a list or menu? Is this something your controller could pass to your View? you could pass out a list of all allowed (or forbidden, whichever is more appropriate) and check that before you display a link.
if (allowedLink.Contans(myLink)
// show enabled link
else
//show disabled
The other good way would be to override the HtmlHelper for ActionLinks and make it do the check for permissions for you. Then if they do not have permissions, your html helper would display it disabled.
For examples, see this link http://www.asp.net/learn/mvc/tutorial-09-cs.aspx
Off the top of my head...
• You can set the onClick action for each link to do nothing.
• You can set the URL for the link to "#", which does nothing.

Creating custom content sections with umbraco

I'm working on an umbraco website just now and one of the requirements is to have a custom section in the back end that can be used to manage publish smaller micro-sites.
I have been able to create the new section and added some nodes to it. What I can't get to work is publishing them and making them viewable at the correct url.
As an example, say i have created a new section called microsite, inside that there is a folder called myportfolio. this should route to something like www.myumbracosite.com/microsite/myportfolio.
Does anyone know how to get this sort of thing working? Is it even possible to publish content from outsite of the main content section?
Any help would be greatly apprechiated.
Kind Regards
Colin G
From my understanding the custom sections are for linking to custom databases or data somewhere that needs an interface.
That said, you can use UrlRewriting and an existing content page with a macro to do something like that.
If you had a page called microsite, then using UrlRewriting you could make the parameter passed in to microsite.aspx (a content page in Umbraco) be "myportfolio".
With a user control on the microsite template it could display some content from your external database (or wherever your custom section stores it).
Not sure that's what you're looking for...
Why are you trying to create a new section for more content? The current Umbraco content area has all kinds of permissions for both users and members. Are the microsites all in the same install of Umbraco?
Another option is that the custom section could simply be used as a setup wizard for the new sites. You could create new content and users in their normal places and just use the new section to create them. It's not too hard to create content from C#, so it would probably be the same as doing it from a user control.
Could you provide a little more info?

Resources