File tree Expand file tree Collapse file tree 3 files changed +22
-2
lines changed
canonicalwebteam/directory_parser Expand file tree Collapse file tree 3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1- from canonicalwebteam .directory_parser .app import scan_directory # noqa
1+ from canonicalwebteam .directory_parser .app import ( # noqa
2+ scan_directory , # noqa
3+ generate_sitemap , # noqa
4+ )
Original file line number Diff line number Diff line change 1+ import flask
12import re
23import subprocess
34from contextlib import suppress
@@ -266,6 +267,22 @@ def get_git_last_modified_time(path):
266267 return None
267268
268269
270+ def generate_sitemap (directory_path , base_url ):
271+ """
272+ Generate sitemap given a directory path and a base url. It uses the
273+ local project's templates to generate the sitemap.
274+
275+ TODO: Include sitemap_template.xml in the directory_parser package
276+ """
277+ tree = scan_directory (directory_path )
278+ xml_sitemap = flask .render_template (
279+ "/sitemap_template.xml" ,
280+ tree = tree ["children" ],
281+ base_url = base_url ,
282+ )
283+ return xml_sitemap
284+
285+
269286def scan_directory (path_name , base = None ):
270287 """
271288 We scan a given directory for valid pages and return a tree
Original file line number Diff line number Diff line change 44
55setup (
66 name = "canonicalwebteam.directory-parser" ,
7- version = "1.1.0 " ,
7+ version = "1.1.1 " ,
88 author = "Canonical webteam" ,
99 author_email = "webteam@canonical.com" ,
1010 url = "https://github.com/canonical/canonicalwebteam.directory-parser" ,
You can’t perform that action at this time.
0 commit comments