Developer forum

Forum » CMS - Standard features » Error when trying to access a group/folder from content

Error when trying to access a group/folder from content

Jimmy Hartington
Jimmy Hartington
Reply

On a solution we get an error in front-end when trying to access a group/folder from the content.

Like with this link: https://fsr.dk/skat and it triggers an error in the event log.

I know I can add a shortcut on the folder.

But I was curious if any other have run into this and has solved in a more general/programatical way.

Or if there is a feature I am not aware of, like setting a 404 page, but only for groups/folders.


Replies

 
Jimmy Hartington
Jimmy Hartington
Reply

Anyone?

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Jimmy

I got that reproduced. I would like to see the error you have encountered.

The one I got was coming from a template - but I can see that we might need to handle navigation to folders in the tree.

 
Jimmy Hartington
Jimmy Hartington
Reply

Hi Nicol(AI)

Here are some of the screen shots from the errors we got.

We have in the database set shortcuts to www.fsr.dk on most groups to try and avoid the issue.

image-11.png image-12.png image-13.png image-14.png
 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Jimmy

Yes - that is a template error. The folder gets the page layout template, but it probably lacks the item as the folder do not have items, and then the template fails.

You can also add this to the top of the master template:

@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>

@{

 if (Model.Item is null)

 {

 <h1>Page does not have an item</h1>

 var page = Dynamicweb.Content.Services.Pages.GetPage(Model.ID);

 if (page is not null && page.IsFolder)

 {

 <h1>Page is a folder</h1>

 }

 return;

 }

}

I'll see how this has to be changed. I am not sure I want to go 404 for folders by default - as they can render, if the template is correct. So it would be a change of behavior - maybe with side affects we do not want. But it should probably return 404 - at least as an option.

BR Nicolai

 
Jimmy Hartington
Jimmy Hartington
Reply

Thanks for the answer. We will look into it.

 

You must be logged in to post in the forum