diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py index ac39831a5..325895313 100644 --- a/r2/r2/controllers/listingcontroller.py +++ b/r2/r2/controllers/listingcontroller.py @@ -106,6 +106,7 @@ class ListingController(RedditController): show_sidebar = self.show_sidebar, nav_menus = self.menus, title = self.title(), + robots = getattr(self, "robots", None), **self.render_params).render() return res @@ -581,6 +582,9 @@ class UserController(ListingController): self.render_params = {'user' : vuser} c.profilepage = True + if vuser.pref_hide_from_robots: + self.robots = 'noindex,nofollow' + return ListingController.GET_listing(self, **env) @validate(vuser = VExistingUname('username')) diff --git a/r2/r2/controllers/post.py b/r2/r2/controllers/post.py index 4ef8b0f1f..143d372c3 100644 --- a/r2/r2/controllers/post.py +++ b/r2/r2/controllers/post.py @@ -75,6 +75,7 @@ class PostController(ApiController): pref_organic = VBoolean('organic'), pref_newwindow = VBoolean('newwindow'), pref_public_votes = VBoolean('public_votes'), + pref_hide_from_robots = VBoolean('hide_from_robots'), pref_hide_ups = VBoolean('hide_ups'), pref_hide_downs = VBoolean('hide_downs'), pref_over_18 = VBoolean('over_18'), diff --git a/r2/r2/i18n/en/LC_MESSAGES/r2.po b/r2/r2/i18n/en/LC_MESSAGES/r2.po index 5e75a08a9..724bdb285 100644 --- a/r2/r2/i18n/en/LC_MESSAGES/r2.po +++ b/r2/r2/i18n/en/LC_MESSAGES/r2.po @@ -1608,6 +1608,10 @@ msgstr "privacy options" msgid "make my votes public" msgstr "make my votes public" +#: r2/templates/prefoptions.html:269 +msgid "don't allow search engines to index my user profile" +msgstr "don't allow search engines to index my user profile" + #: r2/templates/prefoptions.html:115 msgid "" "i am over eighteen years old and willing to view adult content" diff --git a/r2/r2/i18n/r2.pot b/r2/r2/i18n/r2.pot index 8cbd4a200..2308b397d 100644 --- a/r2/r2/i18n/r2.pot +++ b/r2/r2/i18n/r2.pot @@ -2527,6 +2527,10 @@ msgstr "" msgid "make my votes public" msgstr "" +#: r2/templates/prefoptions.html:269 +msgid "don't allow search engines to index my user profile" +msgstr "" + #: r2/templates/prefupdate.html:28 msgid "update your email or password" msgstr "" diff --git a/r2/r2/models/account.py b/r2/r2/models/account.py index c01af4ca5..ecd8842c8 100644 --- a/r2/r2/models/account.py +++ b/r2/r2/models/account.py @@ -48,6 +48,7 @@ class Account(Thing): pref_newwindow = False, pref_clickgadget = 5, pref_public_votes = False, + pref_hide_from_robots = False, pref_research = False, pref_hide_ups = False, pref_hide_downs = False, diff --git a/r2/r2/templates/prefoptions.html b/r2/r2/templates/prefoptions.html index 1a00fe4c4..ba2d6c564 100644 --- a/r2/r2/templates/prefoptions.html +++ b/r2/r2/templates/prefoptions.html @@ -265,6 +265,14 @@ ) +
+ ${checkbox(_("don't allow search engines to index my user profile"), "hide_from_robots")} + + + ( + ${_("details")} + ) + %endif