I am trying to calculate the direct link to the file source in git. However, the content comes from multiple git repositories, so I cannot just use .File.Dir to get the path within the git repo.
I can have the file content/dir/_index.md with property cascade.git: https://github.com/my/repo. Then to get the path to content/dir/example/index.md in the git repo I would need the path relative to content/dir (https://github.com/my/repo/blob/master/example/index.md).
I can also cascade the directory where the _index.md file is and then calculate the relative path with that param and .File.Dir. But I would have to remember to keep them updated it if their path changes.
Is there a way to get the path to the file that is cascading the git param without having to hardcode it?
Thanks I did not think about that . Here is my take for reference.
On main file
{{ $filePath := .File.Path }}
{{ $parentPath := partial "getPath.html" . }}
<p>
The dir of parent is {{ $parentPath }}<br>
The path of file is {{ $filePath }}<br>
The rel path is {{ strings.TrimPrefix $parentPath $filePath}}
</p>