I've created an Orchard Website that consists of many mini-websites made operable via theme selection relating and triggered by the current [unique] URL all from the same DB.
It works as I'd hoped, but I wish to improve the Autoroute paths of my pages.
Currently I'm using:
{Content.Fields.PageOrderPart.SitesTaxonomy.Terms:0}/{Content.Slug}
Which results in:
www.site1.com/sitealpha/gallery
www.site2.com/sitebeta/gallery
What I would like is:
www.site1.com/gallery
www.site2.com/gallery
However, I still need to be able to differentiate pages with the same name [...hence why the Autoroute path above was created in the first place] - or I will obviously get permalink duplication errors.
Can anyone think of an ingenious way to sort this or is there some Orchard feature I may've missed, perhaps url rewrites or possibly an existing MVC method?
Many thanks for your input, PP
Further thoughts (hopefully this doesn’t influence any other member's sugestions):
Rewrite rules: Probably aren't dynamic enough for the amount of content I have [still increasing] - and I could see any alterations to existing permalinks being a real nightmare.
Besides, for an unkown reason - I and some other Orchard users - can't seem to get a rewrite action to work?
Routes: Honestly, I haven't played with these properly - I can see that capturing and dissecting a URL to stipulate the area / controller / action should be easy enough - but I'm not sure how to go about redirecting to a particular Orchard page?
FilterProvider, IActionFilter: I tested this scenario [which could become quite complicated code wise] and I'm not sure the performance is acceptable -- my dev system seems to really suffer with any code in the 'OnActionExecuting' method.
Update: I've investigated the IActionFilter scenario and it appears my initial performance worries were unfounded [i.e. a fresh install didn't behave any slower with some URL restructuring code on the 'OnActionExecuting' method].
My last hurdle is to discover why IIS Rewrite rules aren't working with Orchard:
https://stackoverflow.com/questions/35226580/orchard-cms-iis-rewrite-rules-do-not-work-for-rewrite-action-types
It could be that multi tenancy would be the feature you are after. You can have one code, one db but they are all completely separate sites. So separate admin areas etc.
http://docs.orchardproject.net/Documentation/Setting-up-a-multi-tenant-orchard-site
Related
I've added a second project to an existing solution and am running into a bit of an issue with routing requests.
When I initially add the second project, there is no problem with routing.
However, I have a DB Context in the original project that I'd like to use from the second. It is when I add the project reference that my issue manifests.
The issue is that I am getting ambiguous routing requests, so I need to find a way to distinguish requests, for example, to the Home Controller.
Be advised, I use attribute routing.
I've come up with a few workarounds:
Copy the DB Context into the second project. This has obvious shortcomings and is the least attractive solution, but it will work.
Set up routes with some distinguishing prefix, i.e. "/proj2Home", etc. While crude, this is the least objectionable and is straight-forward to implement. It does mandate a route value for every Url of the second project but I could hold my nose on that.
I've considered using Middleware but it looks like the error is coming from UseRouting() (although I'm not 100% on this) so I'm not sure what I can do at that point.
Does anyone know of some sort of build-in mechanism to accomplish this?
so I just migrated a bunch of my old web sites to .net mvc and turned them loose on the net last week.
I optimized them as best I know how for SEO but I'm noticing that NONE (not a single one!) of my sub pages is being displayed on google...only my home pages.
I created controllers for the products to try and give them plugs for each page.
ex:
http://www.mywidgets.com/widget_to_make_coffee/coffee_making_widgets
ironically, google is still showing some of my sub-pages from the old site, which I have redirecting to the new, but I fear that when it fully updates its index, I will lose that placement and not gain the placement from my new stuff as it's no-where to be found...
is this bad practice? Should I have structured everything off of the home controller?
Should I have structured everything off of the home controller?
No. Something else it's going on.
One of the advantages of ASP.NET MVC is that you can de-couple your routes (URLs) from the logic of your code (models/views/controllers)
The only important thing is that you have something at the old urls passing a 301 redirect to the new urls. Google will fix itself pretty quickly after that.
Depending on how many incoming links you've got, you might end up keeping the redirector up permanently.
I recently made the decision to develop our new company website (http://www.idealcode.net:8005/AboutUs.aspx) with Umbraco. I hired an Umbraco developer and we started work.
Please don't flame me or anything but I'm starting to worry about my decision.
The main reason why is because I seriously cannot find anything that explains in simple terms the workflow for creating a new page. As a web developer, it seems as much work to create a page in Umbraco than creating one outside of a CMS.
The workflow as we have it is:
Create a master page (probably not required for every page, but in practice seems to be on almost every page)
Create a document type with the PRECISE content areas that will be on the page
I guess at this point our end users can actually create a page...
We spent about 10 hours implementing the blog module and it STILL does not work and the dev needs to customize the template.
As a web developer, I honestly wonder how this is going to save us time? I'm not trying to diss Umbraco--I'm just worried about explaining this to my superiors. I could have created a site with some dynamic areas and blog in ASP.NET MVC in the roughly 20 hours we've spent on this so far...
The best way to get up to speed quickly on Umbraco is to look at the screencasts made from Umbraco corporate:
http://umbraco.tv/products/umbracotv
After that, the Umbraco community is quite good at answering questions and helping out:
http://our.umbraco.org/
As far as your specific question:
I could be wrong, but I think the thing that you aren't leveraging is inheritance. This makes things easier in Umbraco.
First, DocumentTypes can have parents and they inherit the data fields from those parents. For example, a Content Page DocumentType could have the meta information, main content area, and intro text.
Many pages within your site will likely go no further than that. Basically a rich text editor page (think "About Us")
Then when you add the News Item DocumentType, it can inherit all of those fields from Content Page and simply add a Date and Image field (as an example).
DocumentTypes can have many templates available to them. So if the data doesn't change, but the markup (design) does then you can set a new template in the Properties tab.
Templates can have parents as well. So you can build them up like this:
Main Template
|____One Column Layout
|____Generic Content Page
|____News Area
|____Two Column Layout
|____Product Compare
This works just like master pages in ASP.NET.
So this is pretty long winded. Maybe I'll think about a blog post. Does this help at all?
I second your thought, but consider following scenarios:
Umbraco or any CMS is no ideal solution, if:
1) The complete site will end up having only 20 pages
2) There is only a single user / editor of the site
3) The content is not much dynamic and once created will not change over couple of years
4) The site have only maximum 10 end users
5) The data is not pulled from any external source or/and all are static pages
Where as a CMS / Umbraco is solution for:
1) The is dynamic and still growing after first 1000 pages
2) The client have multiple editors and want to maintain history of publications
3) The content is pulled from various external sources
4) Site end users/contributors are 100+ and still growing
5) Last but not least, the site have 1000+++ visitors daily
I can go on and list all the possibilities of having CMS at the first place, but you need to decide and analyse your own requirements. There is no point in deploying a Samurai to kill a mouse, but definitely you should have proper equipment if you are going to hunt a tiger :D, joke apart just don't deploy any CMS for sake of learning.
Mean while, have a look in books available on Umbraco site to get started (http://umbraco.org/get-started/for-developers) or install Runaway module to start with.
Sanjay Zalke
>As a web developer, I honestly wonder how this is going to save us
time
It will save you time once you become proficient. It has a learning curve for sure, but once over that hump it will save you time - (that is not unique to Umbraco). I have used other CMS products that were easier to get my first site up - but then I was disappointed that I pretty much maxed out what the CMS could do for me - so far it doesn't appear that I will outgrow Umbraco's capabilities anytime soon.
Umbraco can be a wise choice if your site content is very dynamic with lots of pages.
The USP of Umbraco is the re-usability of the document types and a clear seperation of mark-up and content. It greatly reduces the headache of the site editor.
Although initially it may seem a bit confusing or i would say intimidating, but with the help of web-casts on http://umbraco.com/help-and-support/video-tutorials and the user forums things can get simpler.
I started using Umbraco a month back and so far experience has been good.
Start thinking about your site in terms of what is in common from one page to another. If every page in your site needs its own master-page than something is wrong. A good site layout will include the flexibility you need from one page to the next, but still enforce consistency and a common design.
Once you have the common elements of all the similar types of pages, start defining document types for this various types of pages. For example, you might have Basic Page document type, a News Item document type. You can define the various other pages, like "HomePage" or "Section Home", etc. If you have a slideshow, you could create a document type for each "slideshow Slide", etc. Umbraco allows you to build out a very flexible content tree very quickly, and is one of its biggest advantages.
Even if I am the only developer on a site, I still prefer using Umbraco over building a non CMS site. Once the site architecture it determined, development becomes very fast.
I am playing with learning ASP.NET MVC as a non-web developer. I am trying to find the best idiom to use for an app that has a concept of selecting a 'project' to work on the first page that affects all other pages.
There seems to be three choices:
Just put the information into the session state. Works fine, but isn't very MVC-ish
Embed the state into all URLs ... so instead of /Products/Details/1 the URLs are all /(project_id)/Products/Details/1
Setting a separate cookie for this information
Since nearly all the URLs in the application would require the current project this seems overkill, and makes constructing the URLs used in any of the views that much more work. It would also require that I validate the permissions on each call since the user could easily modify it.
Any suggestions on the best approach -- is using the session such a bad idea?!
Option 2 out of yours is my choice.
So instead of /Products/1/Details
I would make it Project/1/Products/1/Details
Its just more in line with REST. Its virtually irrelevant to MVC, but if you want your Routes and URLs to read like resources in REST, you'll want the url to collapse at the slashes and carry the state. Other ways are to mark a project id in cookie, but that kills linking, so that as someone leaves and comes back they get put back there.
Session also makes it hard to test if you bind yourself directly to that concept.
Personally, I would just use the session. There's nothing non-MVCish about the session really - think of it as just being part of your model.
Using a cookie is really no different than using the session. Embedding it in the URLs is not a bad option though, especially for "linkability" if that's a concern for your project. But it has the side effect of cluttering up URLs and requiring you to pass that ID around constantly from page to page.
When you start creating an application or site in ASP.NET MVC, what do you do before typing in that first line of code?
I'm personally fond of creating a new ASP.NET MVC Web Application project and then cleaning out controllers/views until I have what is essentially a blank project (i.e. it runs but doesn't offer functionality). Then I start working on my model and adding controllers/views as needed.
I've also read about starter kits and sample applications but I have not yet started actively working with any of them. However, in my reading I have seen authors suggest that it might be good to start off with an existing template and build on it.
I'm trying to determine if there are better ways of starting off a project such that time is saved and/or the resulting deliverable is of higher quality.
The other things I do (I also clear out the controller/views etc)
Put an IOC in place.
Put ELMAH into the project.
Then I grab a coffee and write my first test.
Kindness,
Dan
PS: At some point I shall get around to creating a template for this so I don't redo it everytime. As soon as I decide upon my favourite IOC. :-)
I usually clear out the Content folder as well and put in place a nice CSS reset file and/or a CSS framework like the 960 grid
Before starting any type of project you must know what you want to do. So take a sheet of paper and start writing on here:
The name of your application
Enumerate the features
Make a quick draft of the domain model (entities that you are going to have)
Try finding the ways (choosing a technology) you are going to do different stuff like: data access, validation (client and server side), logging, IoC, Security, Caching etc.
Do a quick draft of all the views you are going to have in your application
Identify any other problems you might need to solve/implement/develop and think how are you going to do that