Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions scripts/check_growth_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,26 @@ def check(path, key, valid):
len({key for _, key in links}) == 2 and
all(key in SLUGS and key != slug and
href == f"/support/{key}/" for href, key in links))
canonical = re.findall(r'<link\s+rel="canonical"\s+href="([^"]+)"', html)
check(path, "correct_canonical",
canonical == [f"https://appdevelopsk.com{path}"])
check(path, "indexable",
not re.search(r'<meta\b[^>]*name="robots"[^>]*noindex', html, re.I))
scripts = re.findall(
r'<script\s+type="application/ld\+json">([\s\S]*?)</script>', html
)
try:
parsed = [json.loads(raw) for raw in scripts]
nodes = []
for item in parsed:
nodes.extend(item.get("@graph", [item]))
types = {node.get("@type") for node in nodes if isinstance(node, dict)}
structured = bool({"WebPage", "SoftwareApplication", "MobileApplication"} & types)
structured = structured and any(
"Android" in json.dumps(node) for node in nodes)
except (TypeError, ValueError, AttributeError):
structured = False
check(path, "valid_app_jsonld", structured)
check(path, "analytics", "related_app_click" in html and "download_click" in html)
check(path, "play_cta", 'data-position="hero"' in html and 'data-position="details"' in html)

Expand Down
28 changes: 28 additions & 0 deletions scripts/test_growth_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,17 @@ def valid_pages():
"instant-judge": ("twotaku", "debate-me")}
for slug in SLUGS:
other = related[slug]
canonical = f"https://appdevelopsk.com/support/{slug}/"
schema = json.dumps({
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": slug,
"operatingSystem": "Android",
"url": canonical,
})
pages[f"/support/{slug}/"] = (
f'<link rel="canonical" href="{canonical}">' +
'<script type="application/ld+json">' + schema + '</script>' +
"related_app_click download_click " +
'data-position="hero" data-position="details" ' +
" ".join(f'<a href="/support/{x}/" data-related-app="{x}">' for x in other))
Expand Down Expand Up @@ -64,6 +74,24 @@ def test_twotaku_missing_related_link_fails(self):
'data-related-app="instant-judge"', "")
self.assertFalse(inspect(data)["passed"])

def test_wrong_canonical_fails(self):
data = valid_pages()
data["/support/twotaku/"] = data["/support/twotaku/"].replace(
'rel="canonical" href="https://appdevelopsk.com/support/twotaku/"',
'rel="canonical" href="https://appdevelopsk.com/support/other/"')
self.assertFalse(inspect(data)["passed"])

def test_noindex_fails(self):
data = valid_pages()
data["/support/debate-me/"] += '<meta name="robots" content="noindex">'
self.assertFalse(inspect(data)["passed"])

def test_invalid_app_jsonld_fails(self):
data = valid_pages()
data["/support/instant-judge/"] = data["/support/instant-judge/"].replace(
'"SoftwareApplication"', '"SomethingOther"', 1)
self.assertFalse(inspect(data)["passed"])

def test_missing_instant_judge_page_fails(self):
data = valid_pages()
del data["/support/instant-judge/"]
Expand Down
12 changes: 12 additions & 0 deletions support/instant-judge/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
<html lang="en">
<head>
<link rel="canonical" href="https://appdevelopsk.com/support/instant-judge/">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "SoftwareApplication",
"name": "Instant Judge",
"url": "https://appdevelopsk.com/support/instant-judge/",
"operatingSystem": "Android",
"applicationCategory": "SocialNetworkingApplication",
"downloadUrl": "https://play.google.com/store/apps/details?id=com.instantjudge.instant_judge",
"description": "Vote on everyday dilemmas, create a post, and see community results when revealed."
}
</script>
<meta property="og:type" content="website">
<meta property="og:site_name" content="SK APPS">
<meta property="og:title" content="Instant Judge – Vote on Dilemmas, See Results">
Expand Down
Loading