summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Schlosser <christoph@linux.com>2025-08-24 18:31:16 +0200
committerChristoph Schlosser <christoph@linux.com>2025-08-24 18:31:40 +0200
commitc665dae57b12a80004e7ee4fca4ea5e9df7378d6 (patch)
tree5dd37dfc186d6bba76d30040a24d2c81983bcbfa
parent54f78e712baafa9ab6072508e004b2b6bf6430f8 (diff)
downloadgit2hugo-c665dae57b12a80004e7ee4fca4ea5e9df7378d6.tar.gz
g2h: Link to commit pages from overview page
-rw-r--r--README.md2
-rw-r--r--g2h/overview_page.py1
-rw-r--r--templates/overview.md4
-rw-r--r--test_repo/git.tgzbin16230 -> 16230 bytes
-rw-r--r--tests/overview_test.py3
5 files changed, 6 insertions, 4 deletions
diff --git a/README.md b/README.md
index b2540bb..4747ebd 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ For a full list of options, their defaults and how they're changing the behavior
Table of branches and table of tags.
Each with name, most recent message summary and last modified date.
- [ ] Link branch and tag name to tree view.
- - [ ] Link commit messages to commit page.
+ - [x] Link commit messages to commit page.
- [x] Log page.
Table with branch/tag, message summary and last modified date columns.
- [x] Link commit messages to commit page.
diff --git a/g2h/overview_page.py b/g2h/overview_page.py
index 8c7a69c..76de8cc 100644
--- a/g2h/overview_page.py
+++ b/g2h/overview_page.py
@@ -9,6 +9,7 @@ class OverviewPage(Page):
def context(self):
return {
'branches': self.branches,
+ 'content_subdir': self.content_subdir,
'tags': self.tags,
'title': self.name
}
diff --git a/templates/overview.md b/templates/overview.md
index c1f1d05..5b93863 100644
--- a/templates/overview.md
+++ b/templates/overview.md
@@ -4,7 +4,7 @@
| Branch | Commit | Date |
|--------|--------|------|
{%- for branch in branches %}
-| {{ branch.name }} | {{ branch.commit.summary }} | {{ branch.commit.committed_datetime.strftime('%Y-%m-%d %H:%M:%S') }} |{% endfor %}
+| {{ branch.name }} | [{{ branch.commit.summary }}](/{{ content_subdir }}/{{ branch.commit.hexsha }}) | {{ branch.commit.committed_datetime.strftime('%Y-%m-%d %H:%M:%S') }} |{% endfor %}
{% else %}
No branches found.
{% endif %}
@@ -13,7 +13,7 @@ No branches found.
| Tag | Commit | Date |
|-----|--------|------|
{%- for tag in tags %}
-| {{ tag.name }} | {{ tag.commit.summary }} | {{ tag.commit.committed_datetime.strftime('%Y-%m-%d %H:%M:%S') }} |{% endfor %}
+| {{ tag.name }} | [{{ tag.commit.summary }}](/{{ content_subdir }}/{{ tag.commit.hexsha }}) | {{ tag.commit.committed_datetime.strftime('%Y-%m-%d %H:%M:%S') }} |{% endfor %}
{% else %}
No tags found.
{% endif %}
diff --git a/test_repo/git.tgz b/test_repo/git.tgz
index 79a44d5..a7ce96e 100644
--- a/test_repo/git.tgz
+++ b/test_repo/git.tgz
Binary files differ
diff --git a/tests/overview_test.py b/tests/overview_test.py
index 57d2f5d..06eea97 100644
--- a/tests/overview_test.py
+++ b/tests/overview_test.py
@@ -1,8 +1,9 @@
from g2h.overview_page import OverviewPage
def test_init():
- page = OverviewPage('test/overview', 'overview test', 'test branch', 'test tag', '')
+ page = OverviewPage('test/overview', 'overview test', 'test branch', 'test tag', 'overview/sub/dir')
context = page.context()
assert(context['title'] == 'overview test')
assert(context['branches'] == 'test branch')
assert(context['tags'] == 'test tag')
+ assert(context['content_subdir'] == 'overview/sub/dir')