dnnsoftware / Dnn.Platform

DNN (formerly DotNetNuke) is the leading open source web content management platform (CMS) in the Microsoft ecosystem.
https://dnncommunity.org/
MIT License
1.03k stars 749 forks source link

Unable to remove site page URL #3097

Open thabaum opened 6 years ago

thabaum commented 6 years ago

Description of bug

Page Settings > Advanced > SEO Unable to edit or remove URLs for pages

Screenshots

site-alias-unable-to-remove

Affected version

Affected browser

skamphuis commented 6 years ago

Do you have more specifics? I've tried 9.2.1 and 9.2.2RC, for both manually added and automatically added page URL's, but I had no issues deleting them.

sleupold commented 6 years ago

please check again on DNN 9.2.2 release and report back, otherwise this issue will be fixes as "cannot reproduce". Please state also, whether you are using single language or multiple languages with or without content localization enabled.

valadas commented 6 years ago

I remember seeing a similar situation on a site I worked on, not sure how to reproduce it but I managed to do what I needed by deleting them in the database one by one as required. Is there any rationale to not allow users to delete the automatic ones unless it is the last one available on the list?

thabaum commented 5 years ago

https://dnntracker.atlassian.net/browse/DNN-10814#add-comment

Another dnn user having same issue today posted here that may give more information to help cure the issue.

valadas commented 5 years ago

Copying a snipped from the jira ticket in here:

On Dnn 9.4.0 RC with content localization enabled and one language added (fr-CA).

Created page A and went to SEO, seing this: (3 times same entry and no edit buttons) image

Then added url B and seing this: image

So multiple things are wrong here:

  1. Duplicate entries in UI
  2. Multiple entries with Active (200)
  3. Cannot edit or delete the automatically generated entries.

On the database side of things after those steps, I only have A in Tabs and only B in TabUrls, I have a feeling this is just a UI issue and the underlying behaviour is fine, so moving this to AdminExperience until the UI is looked at then we can test if the api is fine.

valadas commented 3 years ago

Would anyone object to simply at least allow deleting the system generated ones and just check to ensure the user cannot delete the last Active (200) one. Does any one see a good reason to not allow modifying/deleting system-generated ones ?

sleupold commented 3 years ago

there should be for sure no duplicate entries, DNN should prevent adding it.

madceb commented 3 years ago

This information shows and has a odd behavior, they seem to be duplicated but no, each entry is for a different language, even you are looking the configuration in a language the entries shown are for all languages (maybe a column for language is missing in the UI?), and this behavior seems to be diferente depending what language are you in, default or a diferente localization. The ones that have no delete options seem to be generated by query/logic, not stored in a table as the ones with the delete option. I tried to follow where this information was coming because an other odd behavior that I have with friendly urls, that display the wrong page when navigating to diferente localization. I'm not running latest DNN version, hope this helps.

jahalliv commented 2 years ago

Has there been any work on this, very frustrating.

valadas commented 2 years ago

@jahalliv please consider this is a free open source product, no reason to be frustrated here. Developers work on what they decide to work on and there has been a lot of recent major activity. Also for issues like this that are not obvious to make happen. Writing very very clear steps to reproduce from scratch may help for someone to pick it up.

jahalliv commented 2 years ago

@jahalliv please consider this is a free open source product, no reason to be frustrated here. Developers work on what they decide to work on and there has been a lot of recent major activity. Also for issues like this that are not obvious to make happen. Writing very very clear steps to reproduce from scratch may help for someone to pick it up.

Now 2 reasons to be frustrated.

mitchelsellers commented 2 years ago

As I look at this, unless someone else has different recreation steps, I'm not 100% sure this is actually an issue.

The only way that I have been able to get multiple URL's with the same path, and not able to edit is with a site with individual languages. This is expected, those are the default routes for those languages. Maybe the language should be shown here, that could help.

Custom added ones can be removed.

Renaming a page, results in a redirect from the old, but it can be removed if needed.

Does someone have solid recreation steps for this issue that can cause this issue without it being a multi language site?

valadas commented 2 years ago

I did happen to me but I do not have solid recreation steps. Time providing I would like to allow them to be deleted no matter what (as long as it is not the last active one). Like I said earlier, just did not have the time to implement that.

jahalliv commented 2 years ago

The issue description is just part of it In older versions of DNN you could add a page with a space in the name and then override the URL with a dash removing it. Can't do that anymore. When you try to add it you can't, DNN tells you its "unavailable". Turns out it was silently added as a damn automatic URL that can't be deleted.

mitchelsellers commented 2 years ago

I don't believe that removing the automatic behavior of dashes/not is something that we should be doing in the provider. That would have huge implications for site behaviors.

Ideally, a concise recreation process with notes of what is expected is going to make this actionable.

jahalliv commented 2 years ago

Then at least give the site administrator the option to delete an automatically created redirect OR the option to change it to "active". The way it works now discourages the good practice of eliminating dashes from URLs.

mitchelsellers commented 2 years ago

@jahalliv I'm curious, why do you state that dashes should be removed? The current consensus still supports the usage of dashes for SEO as it is treated as a word-break from a content perspective?

mitchelsellers commented 2 years ago

Straight from Google - https://developers.google.com/search/docs/crawling-indexing/url-structure

jahalliv commented 2 years ago

Mitch, Lets stay on topic and avoid the strawman. No one wants their platform dictating their design practice to justify NOT fixing the problem. But since you brought it up why does DNN now do just that, create an automatic URL with them removed?

valadas commented 1 year ago

5401 might be the way to make this problem happen

mwigley-trilogy commented 1 year ago

Yep, as you've noticed dashed and non-dashed URL's are added automatically for pages and can't be removed (appears to have been by design).

My fix for #5401 should fix all weird UI bugs that you've seen with lots of extra rows showing up.

In terms of adding the ability to remove the 'automatic' URL's, that seems like a reasonable feature to me. I guess I'd suggest a starting point of looking at \Dnn.Platform\Dnn.AdminExperience\Dnn.PersonaBar.Extensions\Components\Pages\PageUrlsController.cs GetPageUrls and how it generates the 'automatic' ('system') Urls in this.GetSortedUrls. The logic appears to get a wee bit complex though, and personally I'd be scared to mess with it too much.

mwigley-trilogy commented 1 year ago

Digging into the code a bit I see that there's a matcher that has these two settings in FriendlyUrlSettings.cs

        public string RegexMatch
        {
            get { return this._regexMatch ?? (this._regexMatch = this.GetStringSetting(ValidFriendlyUrlRegexSetting, @"[^\w\d _-]")); }
            internal set { this._regexMatch = value; }
        }

        public string ReplaceSpaceWith
        {
            get
            {
                // 791 : use threadlocking option
                return this._replaceSpaceWith ?? (this._replaceSpaceWith = this.GetStringSetting(ReplaceSpaceWithSetting, "-"));
            }

            internal set { this._replaceSpaceWith = value; }
        }

edit1: I don't know how the settings stuff works, but I guess it might actually already be configurable by using the settings referenced in FriendlyUrlSettings.cs like: AUM_ValidFriendlyUrlRegex AUM_DoNotRewriteRegEx AUM_DoNotUseFriendlyUrlRegex and/or AUM_ReplaceSpaceWith

There are a bunch of other settings in FriendlyUrlSettings.cs and I suspect that at least one of them will allow disabling dashed URLs. I don't really know how the settings parsing works, but I suspect you can put something in your web.config to override the defaults.

edit2: Upon further investigation I've found that these regex settings are configurable in the UI: (settings => S E O) image image

You can at least turn off the auto-redirection to hyphenated URL's by turning off 'redirect to friendly URLs',

There's only the option to choose between two replacement characters '-' and '_', it'd probably be pretty easy for someone to add another replacement character that's an empty string.

I've found a workaround if you desperately want your URL's to never have dashes - just remove them from the 'valid characters' regex:

image

Bear in mind that I haven't tested that doing this doesn't break other things, so try it at your own risk.

mitchelsellers commented 1 year ago

Yes, all of these settings still work

The history on this is that when DNN Software Acquired UrlMaster years ago, the functionality was left, but the UI was removed from the OpenSource bits.