开发者

How to get a list of pages if site having two pages-with same name?

for example

http://www.sitename.com/section1/pagename.aspx

http://www.sitename.com/section2/pagename.aspx

开发者_运维技巧

I need quick report only for pages which has same name. like "pagename.html" in example.


crawl your site, reverse the found URLs and sort?


If this is a Sitecore site as I'm led to believe, could you not just go into the Content Editor and search for the name you're looking for? Anything with the item name of "pagename", for example, will have a URL ending with "pagename.aspx" in your standard Sitecore install. Just make sure you're looking at the actual item name and not the display name, as they can be quite different at times depending on how you've got the URL's set up.


I would write a quick utility program to just traverse the content tree programmatically, saving the names to a dictionary... when you hit an item that is already in the dictionary, you've got a name collision.


One thing you might consider is writing a filter (I think that is what it is called) for this

http://trac.sitecore.net/AdvancedSystemReporter

That would allow you to have a nice interface in Sitecore for viewing duplicate item names.


How big is your database, and how is your LINQ to Objects? Theoretically you could write a LINQ query against Database.Items that looks for items with the same name that descend from the same site branch of your content tree. This could be very memory intensive if your master DB is large, but would not be difficult to code.

Edit -- if you can loop over all your site items, you could do something like this (untested):

        var items = siteItem.Axes.GetDescendants();
        var dupes = from item in items
                    join item2 in items on item.Name equals item2.Name
                    where item.ID != item2.ID
                    select item;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜