sitemap

Asp.net Mvc: List all the actions on a controller with specific attribute

谁说我不能喝 提交于 2019-11-30 19:24:43
I am trying to list all the controllers and their actions with specific attributes to create a dynamic google sitemap. So that I can "mark" certain actions with an attribute so they show up in the sitemap. Here I found out how to get all the controllers. But I am not sure how to get all their Actions with a particular attribute. I tried GetMethods and then use GetCustomAttributes but I am not sure if that's the right way to do it. It felt a little over complicated. Once I get the controllers and their actions I was going to use the technique explained here to get the urls. As you may notice

Caching sitemaps in django

假如想象 提交于 2019-11-30 13:59:47
问题 I implemented a simple sitemap class using django's default sitemap app. As it was taking a long time to execute, I added manual caching: class ShortReviewsSitemap(Sitemap): changefreq = "hourly" priority = 0.7 def items(self): # try to retrieve from cache result = get_cache(CACHE_SITEMAP_SHORT_REVIEWS, "sitemap_short_reviews") if result!=None: return result result = ShortReview.objects.all().order_by("-created_at") # store in cache set_cache(CACHE_SITEMAP_SHORT_REVIEWS, "sitemap_short

MVC: How to route /sitemap.xml to an ActionResult?

落爺英雄遲暮 提交于 2019-11-30 13:15:49
问题 I've got a SitemapActionResult that overrides the ActionResult, and delivers a SEO sitemap.xml when http://www.sprelle.no/Home/SiteMap is hit. So far so good. What I would like, though, is to serve the sitemap.xml when Google visits /sitemap.xml. For that to work, I need a route that sees "sitemap.xml" and directs to /Home/Sitemap. How do I create this mapping (in the Routes table)? 回答1: Add a map for: routes.MapRoute( "Sitemap", "sitemap.xml", new { controller = "Home", action = "SiteMap" }

Caching sitemaps in django

妖精的绣舞 提交于 2019-11-30 09:29:18
I implemented a simple sitemap class using django's default sitemap app. As it was taking a long time to execute, I added manual caching: class ShortReviewsSitemap(Sitemap): changefreq = "hourly" priority = 0.7 def items(self): # try to retrieve from cache result = get_cache(CACHE_SITEMAP_SHORT_REVIEWS, "sitemap_short_reviews") if result!=None: return result result = ShortReview.objects.all().order_by("-created_at") # store in cache set_cache(CACHE_SITEMAP_SHORT_REVIEWS, "sitemap_short_reviews", result) return result def lastmod(self, obj): return obj.updated_at The problem is that memcache

MVC: How to route /sitemap.xml to an ActionResult?

筅森魡賤 提交于 2019-11-30 06:51:07
I've got a SitemapActionResult that overrides the ActionResult, and delivers a SEO sitemap.xml when http://www.sprelle.no/Home/SiteMap is hit. So far so good. What I would like, though, is to serve the sitemap.xml when Google visits /sitemap.xml. For that to work, I need a route that sees "sitemap.xml" and directs to /Home/Sitemap. How do I create this mapping (in the Routes table)? Add a map for: routes.MapRoute( "Sitemap", "sitemap.xml", new { controller = "Home", action = "SiteMap" } ); Notice that the route, controller, and action options are hard coded. Pablo Andres Barrantes You can used

How to create a sitemap using PHP & MySQL

杀马特。学长 韩版系。学妹 提交于 2019-11-30 06:48:30
I was wondering how can I create a sitemap using PHP & MySQL and is there any sitemap design examples you know of? I use this on my site, it works well and you can point Google's webmaster tools to "this_file.php" and it works wonders! <?php header("Content-type: text/xml"); echo'<?xml version=\'1.0\' encoding=\'UTF-8\'?>'; echo' <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'; include '../include.php'; $sql

Asp.net Mvc: List all the actions on a controller with specific attribute

老子叫甜甜 提交于 2019-11-30 03:48:18
问题 I am trying to list all the controllers and their actions with specific attributes to create a dynamic google sitemap. So that I can "mark" certain actions with an attribute so they show up in the sitemap. Here I found out how to get all the controllers. But I am not sure how to get all their Actions with a particular attribute. I tried GetMethods and then use GetCustomAttributes but I am not sure if that's the right way to do it. It felt a little over complicated. Once I get the controllers

Pinging google sitemap after every new article submission?

有些话、适合烂在心里 提交于 2019-11-29 22:19:09
As you may know, by using the following url, you can 'ping' google to update its record of your sitemap: https://www.google.com/ping?sitemap=URLOFSITEMAP.xml I made a script to do this programmatically after every article submission (I am making a user submitted blog type site). Do you think its a bad idea to do this after every submission and would it be better to do this daily or after some interval? I guess this would come down to whether or not there is a chance that doing this would stall the application execution. The pinging is not done asynchronously so I guess there is always a chance

How to generate the correct sitemap namespace using JAXB and Spring @ResponseBody in controller?

落花浮王杯 提交于 2019-11-29 13:54:22
Everything is working fine with the exception that I cannot create the namespace correctly. Any help is much appreciated! My controller: @Controller @RequestMapping("/sitemap") public class SitemapController { public @ResponseBody XMLURLSet getSitemap(){ XMLURLSet urlSet = new XMLURLSet(); //populate urlList urlSet.setUrl(urlList); return urlSet; } } My urlset: @XmlRootElement(name = "url") public class XMLURL { String loc; @XmlElement(name = "loc") public String getLoc(){ return loc; } public void setLoc(String loc){ this.loc = loc; } } My url element: @XmlRootElement(name = "urlset",