diff --git a/pelican/contents.py b/pelican/contents.py
index 615a7fd8..85543985 100644
--- a/pelican/contents.py
+++ b/pelican/contents.py
@@ -244,9 +244,10 @@ class Content(object):
"Other resources were not found"
" and their urls not replaced"))
elif what == 'category':
- origin = Category(path, self.settings).url
+ origin = '/'.join((siteurl,
+ Category(path, self.settings).url))
elif what == 'tag':
- origin = Tag(path, self.settings).url
+ origin = '/'.join((siteurl, Tag(path, self.settings).url))
# keep all other parts, such as query, fragment, etc.
parts = list(value)
diff --git a/pelican/tests/test_contents.py b/pelican/tests/test_contents.py
index 3c0f8d75..2d21fd24 100644
--- a/pelican/tests/test_contents.py
+++ b/pelican/tests/test_contents.py
@@ -212,17 +212,33 @@ class TestPage(unittest.TestCase):
'link')
page = Page(**args)
content = page.get_content('http://notmyidea.org')
- self.assertEqual(content, ('A simple test, with a '
- 'link'))
+ self.assertEqual(
+ content,
+ 'A simple test, with a '
+ 'link'
+ )
# Category
args['content'] = ('A simple test, with a '
'link')
page = Page(**args)
content = page.get_content('http://notmyidea.org')
- self.assertEqual(content,
- ('A simple test, with a '
- 'link'))
+ self.assertEqual(
+ content,
+ 'A simple test, with a '
+ 'link'
+ )
+
+ # relative_url
+ args['content'] = ('A simple test, with a '
+ 'link')
+ page = Page(**args)
+ content = page.get_content('../../..')
+ self.assertEqual(
+ content,
+ 'A simple test, with a '
+ 'link'
+ )
def test_intrasite_link(self):
# type does not take unicode in PY2 and bytes in PY3, which in