Reduce number of indexed pages

Removes some package search pages from search results. Also removes all package thread lists (as they are redundant)
This commit is contained in:
rubenwardy 2023-04-24 00:17:26 +01:00
parent d16969837c
commit b785a66ae8
4 changed files with 12 additions and 3 deletions

@ -103,7 +103,7 @@ def list_all():
return render_template("packages/list.html",
query_hint=title, packages=query.items, pagination=query,
query=search, tags=tags, selected_tags=selected_tags, type=type_name,
authors=authors, packages_count=query.total, topics=topics)
authors=authors, packages_count=query.total, topics=topics, noindex=qb.noindex)
def getReleases(package):

@ -40,7 +40,7 @@ def list_all():
pid = request.args.get("pid")
if pid:
pid = get_int_or_abort(pid)
package = Package.query.get(pid)
package = Package.query.get_or_404(pid)
query = query.filter_by(package=package)
query = query.filter_by(review_id=None)
@ -52,7 +52,8 @@ def list_all():
pagination = query.paginate(page=page, per_page=num)
return render_template("threads/list.html", pagination=pagination, threads=pagination.items, package=package)
return render_template("threads/list.html", pagination=pagination, threads=pagination.items,
package=package, noindex=pid)
@bp.route("/threads/<int:id>/subscribe/", methods=["POST"])

@ -34,6 +34,11 @@ class QueryBuilder:
return ret
@property
def noindex(self):
return (self.search is not None or len(self.tags) > 1 or len(self.types) > 1 or len(self.hide_flags) > 0 or
self.random or self.lucky or self.author or self.version or self.game)
def __init__(self, args):
title = "Packages"

@ -11,6 +11,9 @@
<link rel="shortcut icon" href="/favicon-16.png" sizes="16x16">
<link rel="icon" href="/favicon-128.png" sizes="128x128">
<link rel="icon" href="/favicon-32.png" sizes="32x32">
{% if noindex %}
<meta name="robots" content="noindex">
{% endif %}
{% block headextra %}{% endblock %}
</head>
<body>