diff --git a/djpress/templatetags/djpress_tags.py b/djpress/templatetags/djpress_tags.py
index 3691adb..c12e63d 100644
--- a/djpress/templatetags/djpress_tags.py
+++ b/djpress/templatetags/djpress_tags.py
@@ -36,16 +36,19 @@ def get_blog_title() -> str:
@register.simple_tag
-def post_author_link(post: Post) -> str:
+def post_author_link(post: Post, link_class: str = "") -> str:
"""Return the author link for a post."""
if not settings.AUTHOR_PATH_ENABLED:
return post.author_display_name
author_url = reverse("djpress:author_posts", args=[post.author])
+ link_class_html = f' class="{link_class}"' if link_class else ""
+
output = (
f'{ post.author_display_name }'
+ f'{ post.author_display_name }"{link_class_html}>'
+ f"{ post.author_display_name }"
)
return mark_safe(output)
diff --git a/djpress/tests/test_djpress_tags.py b/djpress/tests/test_djpress_tags.py
index 986ae72..e4cb4f0 100644
--- a/djpress/tests/test_djpress_tags.py
+++ b/djpress/tests/test_djpress_tags.py
@@ -28,7 +28,7 @@ def category():
@pytest.fixture
-def create_test_post(user):
+def create_test_post(user, category):
post = Post.post_objects.create(
title="Test Post",
slug="test-post",
@@ -65,6 +65,33 @@ def test_post_author_link_with_author_path(create_test_post):
assert djpress_tags.post_author_link(create_test_post) == expected_output
+@pytest.mark.django_db
+def test_post_author_link_with_author_path_with_one_link_class(create_test_post):
+ settings.AUTHOR_PATH_ENABLED = True
+ author_url = reverse("djpress:author_posts", args=[create_test_post.author])
+ expected_output = (
+ f''
+ f"{ create_test_post.author_display_name }"
+ )
+ assert djpress_tags.post_author_link(create_test_post, "class1") == expected_output
+
+
+@pytest.mark.django_db
+def test_post_author_link_with_author_path_with_two_link_class(create_test_post):
+ settings.AUTHOR_PATH_ENABLED = True
+ author_url = reverse("djpress:author_posts", args=[create_test_post.author])
+ expected_output = (
+ f''
+ f"{ create_test_post.author_display_name }"
+ )
+ assert (
+ djpress_tags.post_author_link(create_test_post, "class1 class2")
+ == expected_output
+ )
+
+
@pytest.mark.django_db
def test_post_category_link_without_category_path(category):
settings.CATEGORY_PATH_ENABLED = False