fix readme in .github not found
This commit is contained in:
parent
2ac8821306
commit
eeb752ff63
1 changed files with 4 additions and 5 deletions
|
@ -1,10 +1,10 @@
|
||||||
{{ $repo := .Get "repo" }}
|
{{ $repo := .Get "repo" }}
|
||||||
{{ $rootReadmeURL := printf "https://api.github.com/repos/night0721/%s/contents/README.md" $repo }}
|
{{ $rootReadmeURL := printf "https://api.github.com/repos/night0721/%s/contents/README.md" $repo }}
|
||||||
{{ $githubDirReadmeURL := printf "https://api.github.com/repos/night0721/%s/contents/.github/README.md" $repo }}
|
|
||||||
|
|
||||||
{{ $response := getJSON $rootReadmeURL }}
|
{{ $response := getJSON $rootReadmeURL }}
|
||||||
|
{{ $githubDirReadmeURL := printf "https://api.github.com/repos/night0721/%s/contents/.github/README.md" $repo }}
|
||||||
|
|
||||||
{{ if not (isset $response "content") }}
|
{{ if and (not $response) (not (isset $response "content")) }}
|
||||||
{{ $response = getJSON $githubDirReadmeURL }}
|
{{ $response = getJSON $githubDirReadmeURL }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
@ -16,9 +16,8 @@
|
||||||
{{ $markdown | safeHTML }}
|
{{ $markdown | safeHTML }}
|
||||||
</div>
|
</div>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>Error fetching README from GitHub.</p>
|
<p>No README found for the repository.</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>Error fetching data from GitHub API.</p>
|
<p>Error fetching README from GitHub.</p>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue