Skip to content

Commit

Permalink
Merge pull request #143 from bennuttall/sitemap
Browse files Browse the repository at this point in the history
Implement XML sitemap, close #139
  • Loading branch information
bennuttall committed Apr 29, 2019
2 parents 1fce27d + 0e70352 commit 5cea505
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 230 deletions.
2 changes: 1 addition & 1 deletion piwheels/master/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def get_file_dependencies(self, filename):
"""
with self._conn.begin():
return {
tool: [row.dependency for row in rows]
tool: {row.dependency for row in rows}
for tool, rows in groupby(
self._conn.execute(
"SELECT tool, dependency "
Expand Down
190 changes: 0 additions & 190 deletions piwheels/master/html.py

This file was deleted.

8 changes: 4 additions & 4 deletions piwheels/master/templates/layout.pt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<foo tal:omit-tag="1" metal:define-macro="layout"><!doctype html>
<html class="no-js" lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>piwheels - <span metal:define-slot="title"/></title>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>piwheels - <span metal:define-slot="title" /></title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/foundation/6.4.3/css/foundation-float.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Condensed">
Expand Down
10 changes: 10 additions & 0 deletions piwheels/master/templates/simple_index.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!doctype html>
<html>
<head>
<meta name="api-version" value="2" />
<title>piwheels - Simple index</title>
</head>
<body>
<span tal:repeat="package packages" tal:omit-tag="True"><a href="${package}">${package}</a></span>
</body>
</html>
11 changes: 11 additions & 0 deletions piwheels/master/templates/simple_package.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<title>piwheels - Links for ${package}</title>
</head>
<body>
<h1>Links for ${package}</h1>

<span tal:repeat="row files" tal:omit-tag="True"><a href="${row.filename}#sha256=${row.filehash}">${row.filename}</a><br></span>
</body>
</html>
14 changes: 14 additions & 0 deletions piwheels/master/templates/sitemap_index.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>https://www.piwheels.org/sitemap0.xml</loc>
<lastmod>${timestamp}</lastmod>
</sitemap>
<span tal:repeat="page pages" tal:omit-tag="1">
<sitemap>
<loc>https://www.piwheels.org/sitemap${page+1}.xml</loc>
<lastmod>${timestamp}</lastmod>
</sitemap>
</span>
</sitemapindex>
11 changes: 11 additions & 0 deletions piwheels/master/templates/sitemap_page.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

<span tal:repeat="package packages" tal:omit-tag="1">
<url tal:condition="package">
<loc>https://www.piwheels.org/project/${package}</loc>
</url>
</span>

</urlset>
11 changes: 11 additions & 0 deletions piwheels/master/templates/sitemap_static.pt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

<span tal:repeat="page pages" tal:omit-tag="1">
<url>
<loc>https://www.piwheels.org/${page}</loc>
</url>
</span>

</urlset>

0 comments on commit 5cea505

Please sign in to comment.