don't add an artificial ./ subdir due to how os.path.relpath works
this fixes stuff like og:urls of https://foo/./ or https://foo/./page and also removes an extra layer of depth in the breadcrumb hierarchy, just by suppressing the '.' in relpath output at the root of pages/ fixes #21 Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
@@ -73,6 +73,21 @@ def test_og_image():
|
||||
os.chdir(os.path.join(src_dir, 'pages'))
|
||||
|
||||
ssg.build_file_in_destination(os.path.join(HERE, 'instance', 'pages'), '', 'more-metadata.md', tmpdir, True)
|
||||
with open(os.path.join(tmpdir, 'more-metadata.html'), 'r') as graphviz_output:
|
||||
data = graphviz_output.read()
|
||||
assert ('<meta property="og:image" content="http://example.org/test.img') in data
|
||||
with open(os.path.join(tmpdir, 'more-metadata.html'), 'r') as markdown_output:
|
||||
data = markdown_output.read()
|
||||
assert ('<meta property="og:image" content="http://example.org/test.img">') in data
|
||||
|
||||
|
||||
def test_og_url():
|
||||
"""Test that the og:url meta tag is present as expected."""
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
src_dir = os.path.join(HERE, 'instance')
|
||||
ssg = StaticSiteGenerator(src_dir, tmpdir)
|
||||
os.chdir(os.path.join(src_dir, 'pages'))
|
||||
|
||||
# testing a whole build run because of bugs in how I handle pathing adding a "./" in
|
||||
# the generated URLs for content in the pages/ root
|
||||
ssg.build_in_destination(os.path.join(HERE, 'instance', 'pages'), tmpdir, True)
|
||||
with open(os.path.join(tmpdir, 'index.html'), 'r') as markdown_output:
|
||||
data = markdown_output.read()
|
||||
assert ('<meta property="og:url" content="http://example.org/">') in data
|
||||
|
||||
Reference in New Issue
Block a user