Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sitemap not being included in robots.txt #13

Closed
myusuf3 opened this issue Jul 11, 2013 · 30 comments
Closed

sitemap not being included in robots.txt #13

myusuf3 opened this issue Jul 11, 2013 · 30 comments

Comments

@myusuf3
Copy link

myusuf3 commented Jul 11, 2013

I have tried both default discovery as well as specifying it manually using the ROBOTS_SITEMAP_URLS setting but I am still unable to get the site map to show up on the robots.txt

@andreyshipilov
Copy link

Same here. Doesn't resolve or appear in "robots.txt".

@andreyshipilov
Copy link

In my case it looks like rverse() doesn't respect the cache_page() decorator.

# This one doesn't work.
url(r"^sitemap\.xml$", cache_page(60 * 60)("django.contrib.sitemaps.views.sitemap"), {"sitemaps": SITEMAPS}),
This one does.
url(r"^sitemap\.xml$", "django.contrib.sitemaps.views.sitemap", {"sitemaps": SITEMAPS}),

@yakky
Copy link
Member

yakky commented Dec 22, 2015

@myusuf3 @Tezro I cannot reproduce this, could you provide more details?

@myusuf3
Copy link
Author

myusuf3 commented Dec 23, 2015

woo! wayback machine here. I dont even remember creating this issue.

@SalahAdDin
Copy link

👍

@mheppner
Copy link

mheppner commented Sep 6, 2016

I know this is a pretty old issue, but I wanted to clarify that reverse() does not pick up on the sitemap if it's behind cache_page() in your URL conf. It might be helpful for others to update the documentation. In my case, I was using a main index (django.contrib.sitemaps.views.index) which linked off to the sections (django.contrib.sitemaps.sitemap), so I just took off the caching for the index and django-robots could then reverse to it. The sections can still be cached.

Alternatively, if you just had 1 sitemap, it seems to work fine if you create an alias view and don't use cache_page() directly in your URL conf:

# views.py
from django.contrib.sitemaps import views as sitemaps_views
from django.views.decorators.cache import cache_page

@cache_page(10 * 60)
def sitemap_index(*args, **kwargs):
    return sitemaps_views.index(*args, **kwargs)

@yakky
Copy link
Member

yakky commented Feb 4, 2017

@mheppner when merged, could you check if the fix (which is under way) for #61 solves the cache issue?

@myusuf3
Copy link
Author

myusuf3 commented Feb 6, 2017

4 years guys.

@jezdez
Copy link
Member

jezdez commented Feb 6, 2017

@myusuf3 For the record, that type of snark is counter-productive and I think you should know better. Please be so kind and stop giving this type of feedback.

@mheppner
Copy link

mheppner commented Feb 6, 2017

I sure can @yakky. ETA on the merge? The one you linked is just the issue, did you mean #71?

@yakky
Copy link
Member

yakky commented Feb 7, 2017

@mheppner actually this commit ba2d5b6 sorry
When I wrote the above comment I thought I would have opened a Pr specific for the deprecation but it ended up with the whole general Django version update
I would like to wrap everything by the end of the week

@mheppner
Copy link

mheppner commented Feb 7, 2017

@yakky the link to that commit doesn't work either lol. I'll check out your branch this evening.

@yakky
Copy link
Member

yakky commented Feb 7, 2017

@mheppner 🤦‍♂️

@mheppner
Copy link

mheppner commented Feb 8, 2017

@yakky I tried the features/djangos branch and that didn't seem to change anything. Everything else was fine though. I think the problem me and @andreyshipilov were having is just how cache_page() behaves. That answer is from 2012, so maybe something has changed, but I can't find anything.

What about adding a setting to django-robots for specifying a named URL to reverse to?

@yakky
Copy link
Member

yakky commented Feb 11, 2017

@mheppner I'm not super fond of adding settings, but it seems adequate to cover this case

@yakky
Copy link
Member

yakky commented Feb 11, 2017

@mheppner @andreyshipilov could you please check the linked pr?

@mheppner
Copy link

@yakky looks good to me, thanks! 😃

@yakky yakky closed this as completed in #74 Feb 13, 2017
@yakky
Copy link
Member

yakky commented Feb 13, 2017

@mheppner thanks for the review!

@andreyshipilov
Copy link

@yakky Works for me too :)

@yakky
Copy link
Member

yakky commented Feb 15, 2017

@andreyshipilov 👍 thanks

@SalahAdDin
Copy link

@yakky For when have you planned release a new version?

@yakky
Copy link
Member

yakky commented Feb 24, 2017

@SalahAdDin with a little luck this weekend

@SalahAdDin
Copy link

@yakky, oh i hope!

@yakky
Copy link
Member

yakky commented Feb 26, 2017

@SalahAdDin 3.0rc1 has been released on Pypi. I'm going to check if everything is ok and I will release 3.0 final in a couple of days (sooner if you could confirm rc1 is fine! ;) )

@SalahAdDin
Copy link

Man, i have a problem using the new url version:
seleccion_297
This argument is the problem: {'sitemaps': []}.
I think is a problem because i'm using wagtail's sitemap view. So, deleting this argument cached view works very well.

@mheppner
Copy link

@SalahAdDin Can you give more information about this? Where is that argument you're talking about? For what it's worth, Wagtail doesn't use Django's sitemap framework, they're rolling their own, which means django-robots won't be reversing to it automatically. Can you try giving your URL a name and setting it to ROBOTS_SITEMAP_VIEW_NAME?

@SalahAdDin
Copy link

@mheppner Yes, i did it, i only delete these argument, and works fine.

@yakky yakky mentioned this issue Feb 28, 2017
@yakky
Copy link
Member

yakky commented Feb 28, 2017

@SalahAdDin @mheppner thanks for helping with this. Would you check if linked PR clarifies how to correctly configure robots in the case above?

@mheppner
Copy link

Ah, now I see what @SalahAdDin was talking about. @yakky, yeah I think that clears it up 👍

@mheppner
Copy link

@yakky I just tried 3.0rc1 and everything seems to be working, thanks! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants