The content you're reading is getting on in years
This post is on the older side and its content may be out of date.
Be sure to visit our blogs homepage for our latest news, updates and information.
Alright, what is so special about these Urls?
First of all, the news articles urls depend on where the NewsView control is placed. Then, the NewsView control could use some filter in order to show only certain news articles. There is one more possibility - what if we have two news view controls, so the first one shows the list of items, while the second - the full article? Here is a sample code that considers the above concerns:
I am sure that for the most of you, the code speaks for itself, but here are some notes on what it actually does:
1. Getting all pages.
2. Getting all controls from each page, and select only the NewsView controls
3. Creating a filter from the controls FilterExpression, so we could get the list of items that this control is showing.
4. Checking if there is Detail page specified
5. Building a list of items, having in mind the current page url, the server url and the news article relative url.
If you want to make the things more complicated, you can play with the page additional urls, but if you include those urls in the Sitemap, do not forget to set them with the Canonical Url tag (everyone talks about SEO these days, even me .. sometimes :) )
This pretty much solves the problem. I am sure that you guys can optimize the code, but we want to illustrate the idea here. There might be other ways of getting the news articles urls - we would be glad to know about your idea.
View all posts from The Progress Team on the Progress blog. Connect with us about all things application development and deployment, data integration and digital business.
Subscribe to get all the news, info and tutorials you need to build better business apps and sites
Copyright © 2019 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.