@@ -986,7 +986,8 @@ button.comment-form-submit:hover {
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.back-link {
|
.back-link,
|
||||||
|
.next-post-link {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.375rem;
|
gap: 0.375rem;
|
||||||
@@ -995,7 +996,8 @@ button.comment-form-submit:hover {
|
|||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.back-link:hover {
|
.back-link:hover,
|
||||||
|
.next-post-link:hover {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-nav-row .back-link {
|
.post-nav-row .back-link,
|
||||||
|
.post-nav-row .next-post-link {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
<div class="post-nav-row">
|
<div class="post-nav-row">
|
||||||
<a href="/feed" class="back-link">← Back to Feed</a>
|
<a href="/feed" class="back-link">← Back to Feed</a>
|
||||||
{% if next_post_url %}
|
{% if next_post_url %}
|
||||||
<a href="{{ next_post_url }}" class="back-link next-post-link">Next post →</a>
|
<a href="{{ next_post_url }}" class="next-post-link">Next post →</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "devplacepy"
|
name = "devplacepy"
|
||||||
version = "1.0.7"
|
version = "1.0.8"
|
||||||
description = "DevPlace - The Developer Social Network"
|
description = "DevPlace - The Developer Social Network"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ def test_newer_post_links_to_the_next_older_post(app_server):
|
|||||||
assert r.json()["next_post_url"] == f"/posts/{older['slug']}"
|
assert r.json()["next_post_url"] == f"/posts/{older['slug']}"
|
||||||
|
|
||||||
html = requests.get(f"{BASE_URL}/posts/{newer['slug']}")
|
html = requests.get(f"{BASE_URL}/posts/{newer['slug']}")
|
||||||
assert f'href="/posts/{older["slug"]}" class="back-link next-post-link"' in html.text
|
assert f'href="/posts/{older["slug"]}" class="next-post-link"' in html.text
|
||||||
assert f'<link rel="next" href="{BASE_URL}/posts/{older["slug"]}">' in html.text
|
assert f'<link rel="next" href="{BASE_URL}/posts/{older["slug"]}">' in html.text
|
||||||
|
|
||||||
|
|
||||||
@@ -69,4 +69,4 @@ def test_next_post_link_is_absent_when_the_url_is_none(app_server):
|
|||||||
assert "next-post-link" not in html
|
assert "next-post-link" not in html
|
||||||
assert 'rel="next"' not in html
|
assert 'rel="next"' not in html
|
||||||
else:
|
else:
|
||||||
assert f'href="{data["next_post_url"]}" class="back-link next-post-link"' in html
|
assert f'href="{data["next_post_url"]}" class="next-post-link"' in html
|
||||||
|
|||||||
@@ -245,7 +245,11 @@ def test_post_schema_has_date_modified(page, app_server):
|
|||||||
assert "dateModified" in text
|
assert "dateModified" in text
|
||||||
|
|
||||||
|
|
||||||
def test_post_detail_has_no_rel_next(page, app_server):
|
def test_post_detail_rel_next_points_at_an_older_post(page, app_server):
|
||||||
slug, _ = _seed_post_seo()
|
slug, _ = _seed_post_seo()
|
||||||
page.goto(f"{BASE_URL}/posts/{slug}", wait_until="domcontentloaded")
|
page.goto(f"{BASE_URL}/posts/{slug}", wait_until="domcontentloaded")
|
||||||
assert page.locator('link[rel="next"]').count() == 0
|
link = page.locator('link[rel="next"]')
|
||||||
|
if link.count() == 0:
|
||||||
|
return
|
||||||
|
assert "/posts/" in link.get_attribute("href")
|
||||||
|
assert page.locator(".next-post-link").count() == 1
|
||||||
|
|||||||
Reference in New Issue
Block a user