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
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"level": "DEBUG",
|
||||
"handlers": ["console"]
|
||||
},
|
||||
"incorporealcms.pages": {
|
||||
"incorporealcms.ssg": {
|
||||
"level": "DEBUG",
|
||||
"handlers": ["console"]
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
"""Configure the test application.
|
||||
|
||||
SPDX-FileCopyrightText: © 2020 Brian S. Stephan <bss@incorporeal.org>
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
"""
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'formatters': {
|
||||
'default': {
|
||||
'format': '[%(asctime)s %(levelname)-7s %(name)s] %(message)s',
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'default',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'incorporealcms.mdx': {
|
||||
'level': 'DEBUG',
|
||||
'handlers': ['console'],
|
||||
},
|
||||
'incorporealcms.pages': {
|
||||
'level': 'DEBUG',
|
||||
'handlers': ['console'],
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user