Im not entirely sure if this is possible, but currently, any node within the content tree of umbraco has a URL.
say you have a folder called news categories under the content node, with several news categories within the folder. Each of these nodes would have a URL, but no template attached to it as we dont want to render a news category on the front end. it is merely used for categorisation purposes within the CMS.
Ideally the web.config or similar config file wuld have a NoTemplateAttachedURL setting where you specify what page you want the user taken to.
Currently to overcome this issue, im setting the default value of the newstype "page redirect" property to be that of my 404 page. id be interested to hear if anyone else has any better suggestions.
I guess it's all up to decide what to do when someone is trying to browse the category node. Either a redirect to a 404 (which I don't think it's the best solution), or maybe a internal redirect to the first "news" node under that category?
@Dirk, yes that might be a solution in this specific case, but that still leaves the issue that when you have documents that you don't use for displaying anything, when you visit the url you don't get a 404
i think nodes which don't have template should trigger a 404, because a node with no template does not represent a page, its non-sense to give them an URL (a node is a content, not a page).
You can also create an HttpModule after the umbracoRequestModule.
thanks for all your suggestions. i agree with Thomas R, i dont think that content that should never have a URL should ever be rendered at all with any template. It should trigger a 404. Ill look into creating a HTTP module, thanks all!
I agree too, why a url should be generated for a document that doesn't have template attached to it, in the firts place? that you have to then handle 404 for them. It's like suggesting that there's a url, but please don't click on it. i think it should be in the core, not to generate a url for a node with no template.
Totally agree this should be addressed and great to see it in UA-862 fix for 4.10.0. Below is how I get around this issue. Basically create a simple template with redirect .NET code set to the url of the parent page where all the subnode data is actually getting displayed. This way if the content is indexed by examine then the link can show a true url but when you click it the page is redirected to the parent page.
Below is an example template that I set the sub node document types to and set as the default template. So when a user adds a sub node it will automatically redirect to the correct page if the link is discovered.
Starting with 4.10 a published node with no template will trigger a 404 ie if you request /foo/bar and page bar has no template, it is treated as 404 (runs the 404 handlers, etc).
Unless it redirects (internal or external) which is what you may want to do...
redirect all nodes with no template selected to a 404
Im not entirely sure if this is possible, but currently, any node within the content tree of umbraco has a URL.
say you have a folder called news categories under the content node, with several news categories within the folder. Each of these nodes would have a URL, but no template attached to it as we dont want to render a news category on the front end. it is merely used for categorisation purposes within the CMS.
Ideally the web.config or similar config file wuld have a NoTemplateAttachedURL setting where you specify what page you want the user taken to.
Currently to overcome this issue, im setting the default value of the newstype "page redirect" property to be that of my 404 page. id be interested to hear if anyone else has any better suggestions.
I guess it's all up to decide what to do when someone is trying to browse the category node. Either a redirect to a 404 (which I don't think it's the best solution), or maybe a internal redirect to the first "news" node under that category?
Cheers,
/Dirk
@Dirk, yes that might be a solution in this specific case, but that still leaves the issue that when you have documents that you don't use for displaying anything, when you visit the url you don't get a 404
you're right, and in that case, I'd use a general template and add some info and some links which can take you back to "real data" pages.
Cheers,
/Dirk
@Dirk, yeah that seems like a good option, and what if you want to return a 404 status code on that template?
You could just insert some inline .net code to set the 404 header info in that template, just as you would do with standard asp.net / c# code
Hi,
i think nodes which don't have template should trigger a 404, because a node with no template does not represent a page, its non-sense to give them an URL (a node is a content, not a page).
You can also create an HttpModule after the umbracoRequestModule.
/Thomas
hi all,
thanks for all your suggestions. i agree with Thomas R, i dont think that content that should never have a URL should ever be rendered at all with any template. It should trigger a 404. Ill look into creating a HTTP module, thanks all!
I agree too, why a url should be generated for a document that doesn't have template attached to it, in the firts place? that you have to then handle 404 for them. It's like suggesting that there's a url, but please don't click on it. i think it should be in the core, not to generate a url for a node with no template.
Check out U4-862: Hide Preview Button and "Link to Document" on content nodes that are not intended for display (e.g., those that have no templates) in the issue tracker and vote it up if you think this would be a good change to have in the core!
Totally agree this should be addressed and great to see it in UA-862 fix for 4.10.0. Below is how I get around this issue. Basically create a simple template with redirect .NET code set to the url of the parent page where all the subnode data is actually getting displayed. This way if the content is indexed by examine then the link can show a true url but when you click it the page is redirected to the parent page.
Below is an example template that I set the sub node document types to and set as the default template. So when a user adds a sub node it will automatically redirect to the correct page if the link is discovered.
<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
<script type="C#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Response.Redirect("/Links.aspx");
}
script>
<asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
asp:Content>
Hope it helps someone.
Jason
Starting with 4.10 a published node with no template will trigger a 404 ie if you request /foo/bar and page bar has no template, it is treated as 404 (runs the 404 handlers, etc).
Unless it redirects (internal or external) which is what you may want to do...
is working on a reply...