skip to Main Content

I have a calendar located at http://domain.com/calendar/. This shows the current month’s events. Other months can be viewed at

  • http://domain.com/calendar/january/
  • http://domain.com/calendar/february/
  • and so on

This means that at the moment (i.e. September) the URL http://domain.com/calendar/september/ is showing duplicate content to http://domain.com/calendar/. My initial thought was to redirect users from http://domain.com/calendar/ to http://domain.com/calendar/{current-month}/. However, this would then cause search engines to always send users to the URL for the month in which they last indexed rather than the main calendar URL.

It is not an option to disable the main calendar URL as this is linked to via literature.

What is the best way of dealing with this scenario? Should I redirect from the main URL to the specific month? If so, should this be a temporary redirect (i.e. a 302)? I suspect not as this is not really what that type of redirect is for. Or is this just something I shouldn’t worry about?

I am not concerned by adding the year into the URL at this stage.

3

Answers


  1. I would set up my routes so that the month parameter was optional. If a user navigates to http://domain.com/calendar/ my controller would use the current month by default. If a user navigates to http://domain.com/calendar/{month}/ then it would use the month provided in the url and display that month instead.

    Ultimately I would have a single endpoint for displaying the calendar that accepts an optional route parameter for displaying a specific month.

    Here is how I would create the route using C# and Mvc:

    public class CalendarController : Controller
    {
        public ActionResult Index(string month)
        {
            if(month == "")
            {
                month = DateTime.Today.ToString("MMMM");
            }
    
            ViewBag.Month = month;
            // ViewBag.Data = getData(month); // method to get events for month
    
            return View();
        }
    }
    

    And my route would look like:

    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    
            // /calendar/october
            routes.MapRoute(
                "Calendar",
                "calendar/{month}",
                new {controller = "Calendar", action = "Index", month = ""});
        }
    }
    
    Login or Signup to reply.
  2. What if you add the redirect in javascript (<body onload="setTimeout(document.location.href=get_next_month_url_function_you_make(),10)">) after a timeout of 10 ms, so the search engine will keep linking to /calendar/ (which you should give an appropriate timeout meta tag), and users will get redirected to the month’s detail page?

    Login or Signup to reply.
  3. I would leave your current calendar route as is at /calendar, and NOT redirect to the /calendar/year/{currentmonth} page.

    For previous months you should create an archive along with the year /calendar/year/month

    If you have some type of indication that the /calendar route is a unique, static route that will always contain up-to-date events (in the form of a page title, content, etc.) it can always be indexed as such in search engines.

    I wouldn’t redirect from archive pages to the current calendar. You could differentiate the archive by doing something like prepending Archive: to page titles and allow it to be indexed, as it will become its own unique content the following month.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search