diff --git a/doc/conf.py b/doc/conf.py index fb47eab1d19..22c973073fb 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -150,7 +150,14 @@ html_theme_options = {} repository = "GenericMappingTools/pygmt" repository_url = "https://github.com/GenericMappingTools/pygmt" -commit_link = f'{ __commit__[:8] }' +if __commit__: + commit_link = ( + f'{ __commit__[:8] }' + ) +else: + commit_link = ( + f'{ __version__ }' + ) html_context = { "menu_links": [ ( diff --git a/pygmt/__init__.py b/pygmt/__init__.py index 2aeb76d10a6..033a21f631b 100644 --- a/pygmt/__init__.py +++ b/pygmt/__init__.py @@ -47,7 +47,7 @@ # Get semantic version through setuptools-scm __version__ = f'v{get_distribution("pygmt").version}' # e.g. v0.1.2.dev3+g0ab3cd78 -__commit__ = __version__.split("+g")[-1] # 0ab3cd78 +__commit__ = __version__.split("+g")[-1] if "+g" in __version__ else "" # 0ab3cd78 # Start our global modern mode session _begin()