Hugo: Support configurable repoPath in GitInfo

Created on 22 Mar 2017  路  6Comments  路  Source: gohugoio/hugo

Overview

This is a request for an enhancement to GitInfo that would enable one to use GitInfo for Hugo sites where the content directory is a .git submodule.

Use case / motivation

I have my content set up as a submodule for a hugo site so that I can version content independently from the logic of the website and/or theme.

I would like to be able to utilize GitInfo functions to show when each page was revised, by who, and when. All of this logic is available thanks to @bep et al.'s work on gitinfo and gitmap. But, currently GitInfo assumes a single git repo (as far as I understand) and does not yet accommodate submodules.

Example file tree, where hugo-website is the main .git repo and content is a submodule:

/hugo_website
|--.git
|--.gitmodules
|-- content
|    `--.git
|-- themes
|--...etc (other files)

Request

Here are two routes that come to mind:

(a) Automatic discovery - GitInfo checks to see if content is a .git repository and is specified as a submodule in .gitmodules. If these conditions are met, then repoPath is set to contentRoot

(b) User sets params - Allow users to set the repoPath for GitInfo via config options.

Would this be useful to others and/or an enhancement the core team would consider a worthwhile addition?

Enhancement Stale

Most helpful comment

@oskarrough You can use getJSON and GitHub (even Gitlab) API to get such info for any repo (example -- Search for getJSON in there).

For further discussion, please start a thread on https://discourse.gohugo.io/.

All 6 comments

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

Hey @bep, hey @willpatera, can this issue be re-opened? We are stuck with exactly the same issue and would benefit from a solution.

Adrian

@EddEdw I would be happy for someone to re-open this issue (and implement this functionality), but I do not have the power to do so myself.

Based on the lack of comments/interest generated by my original issue, it does not seem like this feature will be implemented :tipping_hand_man:

A use-case for this feature would be outputting last commit date from a child theme in a git submodule. Does anyone know of a workaround?

@oskarrough You can use getJSON and GitHub (even Gitlab) API to get such info for any repo (example -- Search for getJSON in there).

For further discussion, please start a thread on https://discourse.gohugo.io/.

Hi I have a same issue. I need lastmodified timestamp and my content is another .git repo.
I reached here through https://discourse.gohugo.io/t/gitinfo-for-content-in-separate-git-repository-submodule/5882

Please let me know if there is a workaround other than getJSON. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrissparksnj picture chrissparksnj  路  3Comments

geddski picture geddski  路  3Comments

kaushalmodi picture kaushalmodi  路  3Comments

carandraug picture carandraug  路  3Comments

VoidingWarranties picture VoidingWarranties  路  3Comments