Skip to content

Commit 68595ef

Browse files
committed
Merge tag '5.4.1' into rel
2 parents 7c9c70b + e2d4c72 commit 68595ef

40 files changed

+569
-242
lines changed

CHANGELOG.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
Version 5.4.1
2+
-------------
3+
4+
:Date: September 01, 2020
5+
6+
* `@stsewd <https://github.com/stsewd>`__: Docs: update readthedcos-sphinx-search ext (`#7427 <https://github.com/readthedocs/readthedocs.org/pull/7427>`__)
7+
* `@humitos <https://github.com/humitos>`__: Upgrade Django to 2.2.16 (`#7426 <https://github.com/readthedocs/readthedocs.org/pull/7426>`__)
8+
* `@bmorrison4 <https://github.com/bmorrison4>`__: Fix typo in docs/guides/adding-custom-css.rst (`#7424 <https://github.com/readthedocs/readthedocs.org/pull/7424>`__)
9+
* `@stsewd <https://github.com/stsewd>`__: Test: set privacy level explicitly (`#7422 <https://github.com/readthedocs/readthedocs.org/pull/7422>`__)
10+
* `@stsewd <https://github.com/stsewd>`__: Pip: test new resolver (`#7412 <https://github.com/readthedocs/readthedocs.org/pull/7412>`__)
11+
* `@stsewd <https://github.com/stsewd>`__: Update common (`#7411 <https://github.com/readthedocs/readthedocs.org/pull/7411>`__)
12+
* `@stsewd <https://github.com/stsewd>`__: Release 5.4.0 (`#7410 <https://github.com/readthedocs/readthedocs.org/pull/7410>`__)
13+
* `@stsewd <https://github.com/stsewd>`__: Docker: install requirements from local changes (`#7409 <https://github.com/readthedocs/readthedocs.org/pull/7409>`__)
14+
* `@stsewd <https://github.com/stsewd>`__: ES: update dependencies (`#7408 <https://github.com/readthedocs/readthedocs.org/pull/7408>`__)
15+
* `@pyup-bot <https://github.com/pyup-bot>`__: pyup: Scheduled weekly dependency update for week 34 (`#7406 <https://github.com/readthedocs/readthedocs.org/pull/7406>`__)
16+
* `@stsewd <https://github.com/stsewd>`__: API client: don't retry on POST (`#7383 <https://github.com/readthedocs/readthedocs.org/pull/7383>`__)
17+
* `@saadmk11 <https://github.com/saadmk11>`__: build_url added to all API v3 build endpoints (`#7373 <https://github.com/readthedocs/readthedocs.org/pull/7373>`__)
18+
* `@stsewd <https://github.com/stsewd>`__: Guide: deprecating content (`#7333 <https://github.com/readthedocs/readthedocs.org/pull/7333>`__)
19+
* `@humitos <https://github.com/humitos>`__: Auto-join email users field for Team model (`#7328 <https://github.com/readthedocs/readthedocs.org/pull/7328>`__)
20+
* `@stsewd <https://github.com/stsewd>`__: Guide: Cross-referencing with Sphinx (`#7326 <https://github.com/readthedocs/readthedocs.org/pull/7326>`__)
21+
* `@humitos <https://github.com/humitos>`__: Sync RemoteRepository and RemoteOrganization in all VCS providers (`#7310 <https://github.com/readthedocs/readthedocs.org/pull/7310>`__)
22+
* `@stsewd <https://github.com/stsewd>`__: Page views: use origin URL instead of page name (`#7293 <https://github.com/readthedocs/readthedocs.org/pull/7293>`__)
23+
124
Version 5.4.0
225
-------------
326

dockerfiles/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ RUN ln -s /usr/bin/python3 /usr/bin/python
3939

4040
WORKDIR /tmp
4141

42-
RUN curl -O https://raw.githubusercontent.com/readthedocs/readthedocs.org/master/requirements/pip.txt
43-
RUN curl -O https://raw.githubusercontent.com/readthedocs/readthedocs.org/master/requirements/docker.txt
42+
COPY requirements/pip.txt pip.txt
43+
COPY requirements/docker.txt docker.txt
4444
RUN pip3 install --no-cache-dir -r docker.txt
4545

4646
# Install readthedocs-ext only if GITHUB_TOKEN is provided

docs/guides/adding-custom-css.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ A similar approach can be used to add JavaScript files::
4242
.. note::
4343

4444
The Sphinx HTML options ``html_css_files`` and ``html_js_files``
45-
where added in Sphinx 1.8.
45+
were added in Sphinx 1.8.
4646
Unless you have a good reason to use an older version,
4747
you are strongly encouraged to upgrade.
4848
Sphinx is almost entirely backwards compatible.

docs/guides/deprecating-content.rst

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
Deprecating Content on Read the Docs
2+
====================================
3+
4+
When you deprecate a feature from your project,
5+
you may want to deprecate its docs as well,
6+
and stop your users from reading that content.
7+
8+
Deprecating content may sound as easy as delete it,
9+
but doing that will break existing links,
10+
and you don't necessary want to make the content inaccessible.
11+
Here you'll find some tips on how to use Read the Docs to deprecate your content
12+
progressively and in non harmful ways.
13+
14+
Deprecating versions
15+
--------------------
16+
17+
If you have multiple versions of your project,
18+
it makes sense to have its :doc:`documentation versioned </versions>` as well.
19+
For example, if you have the following versions and want to deprecate v1.
20+
21+
- ``https://project.readthedocs.io/en/v1/``
22+
- ``https://project.readthedocs.io/en/v2/``
23+
- ``https://project.readthedocs.io/en/v3/``
24+
25+
For cases like this you can *hide* a version.
26+
Hidden versions won't be listed in the versions menu of your docs,
27+
and they will be listed in a :ref:`robots.txt file <hosting:custom robots.txt pages>`
28+
to stop search engines of showing results for that version.
29+
30+
Users can still see all versions in the dashboard of your project.
31+
To hide a version go to your project and click on :guilabel:`Versions` > :guilabel:`Edit`,
32+
and mark the :guilabel:`Hidden` option. Check :ref:`versions:Version States` for more information.
33+
34+
.. note::
35+
36+
If the versions of your project follow the semver_ convention,
37+
you can activate the :ref:`versions:version warning` option for your project.
38+
A banner with a warning and linking to the stable version
39+
will be shown on all versions that are lower than the stable one.
40+
41+
.. _semver: https://semver.org/
42+
43+
Deprecating content
44+
-------------------
45+
46+
You may not always want to deprecate a version, but deprecate some pages.
47+
For example, if you have documentation about two APIs and you want to deprecate v1:
48+
49+
- ``https://project.readthedocs.io/en/latest/api/v1.html``
50+
- ``https://project.readthedocs.io/en/latest/api/v2.html``
51+
52+
A simple way is just adding a warning at the top of the page,
53+
this will warn users visiting that page,
54+
but it won't stop users from being redirected to that page from search results.
55+
You can add an entry of that page in a :ref:`custom robots.txt <hosting:custom robots.txt pages>` file
56+
to avoid search engines of showing those results. For example::
57+
58+
# robots.txt
59+
60+
User-agent: *
61+
62+
Disallow: /en/latest/api/v1.html # Deprecated API
63+
64+
But your users will still see search results from that page if they use the search from your docs.
65+
With Read the Docs you can set a :ref:`custom rank per pages <config-file/v2:search.ranking>`.
66+
For example:
67+
68+
.. code-block:: yaml
69+
70+
# .readthedocs.yaml
71+
72+
version: 2
73+
search:
74+
ranking:
75+
api/v1.html: -1
76+
77+
This wont hide results from that page, but it will give priority to results from other pages.
78+
79+
.. TODO: mention search.ignore when it's implemented.
80+
81+
82+
.. tip::
83+
84+
If you are using Sphinx with reStructuredText,
85+
you can make use of some :doc:`directives <sphinx:usage/restructuredtext/directives>`
86+
like ``warning``, ``deprecated``, ``versionchanged`` to warn your users about deprecated content.
87+
88+
Moving and deleting pages
89+
-------------------------
90+
91+
After you have deprecated a feature for a while,
92+
you may want to get rid of its documentation,
93+
that's OK, you don't have to maintain that content forever.
94+
But be aware that users may have links of that page saved,
95+
and it will be frustrating and confusing for them to get a 404.
96+
97+
To solve that problem you can create a redirect to a page with a similar feature/content,
98+
like redirecting to the docs of the v2 of your API when your users visit the deleted docs from v1,
99+
this is a :ref:`page redirect <user-defined-redirects:page redirects>` from ``/api/v1.html`` to ``/api/v2.html``.
100+
See :doc:`/user-defined-redirects`.

docs/guides/platform.rst

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ Read the Docs Guides
44
These guides will help you customize or tune aspects of Read the Docs.
55

66
.. toctree::
7-
:maxdepth: 1
7+
:maxdepth: 1
88

9-
autobuild-docs-for-pull-requests
10-
build-notifications
11-
build-using-too-many-resources
12-
canonical
13-
conda
14-
environment-variables
15-
feature-flags
16-
google-analytics
17-
hiding-a-version
18-
searching-with-readthedocs
19-
embedding-content
20-
specifying-dependencies
21-
technical-docs-seo-guide
22-
wipe-environment
9+
autobuild-docs-for-pull-requests
10+
build-notifications
11+
build-using-too-many-resources
12+
canonical
13+
conda
14+
deprecating-content
15+
environment-variables
16+
feature-flags
17+
google-analytics
18+
hiding-a-version
19+
searching-with-readthedocs
20+
embedding-content
21+
specifying-dependencies
22+
technical-docs-seo-guide
23+
wipe-environment

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readthedocs/analytics/signals.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,41 @@
44
from django.utils import timezone
55

66
from readthedocs.api.v2.signals import footer_response
7+
from readthedocs.core.unresolver import unresolve_from_request
78
from readthedocs.projects.models import Feature
89

910
from .models import PageView
1011

1112

1213
@receiver(footer_response)
13-
def increase_page_view_count(sender, **kwargs):
14+
def increase_page_view_count(sender, *, request, context, absolute_uri, **kwargs):
1415
"""Increase the page view count for the given project."""
15-
del sender # unused
16-
context = kwargs['context']
16+
# unused
17+
del sender
18+
del kwargs
1719

1820
project = context['project']
1921
version = context['version']
20-
# footer_response sends an empty path for the index
21-
path = context['path'] or '/'
22-
23-
if project.has_feature(Feature.STORE_PAGEVIEWS):
24-
page_view, _ = PageView.objects.get_or_create(
25-
project=project,
26-
version=version,
27-
path=path,
28-
date=timezone.now().date(),
29-
)
30-
PageView.objects.filter(pk=page_view.pk).update(
31-
view_count=F('view_count') + 1
32-
)
22+
23+
if not absolute_uri or not project.has_feature(Feature.STORE_PAGEVIEWS):
24+
return
25+
26+
unresolved = unresolve_from_request(request, absolute_uri)
27+
if not unresolved:
28+
return
29+
30+
path = unresolved.filename
31+
32+
fields = dict(
33+
project=project,
34+
version=version,
35+
path=path,
36+
date=timezone.now().date(),
37+
)
38+
39+
page_view = PageView.objects.filter(**fields).first()
40+
if page_view:
41+
page_view.view_count = F('view_count') + 1
42+
page_view.save(update_fields=['view_count'])
43+
else:
44+
PageView.objects.create(**fields, view_count=1)

0 commit comments

Comments
 (0)