-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
427 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{{/* Get remote data. */}} | ||
{{ $data := slice }} | ||
{{ $url := "https://api.github.com/users/arran4/repos" }} | ||
{{ $githubToken := getenv "GITHUB_TOKEN" }} | ||
{{ $headers := dict }} | ||
{{ if $githubToken }} | ||
{{ $headers = dict "Authorization" (printf "token %s" $githubToken) }} | ||
{{ end }} | ||
{{ $perPage := 100 }} | ||
{{ $maxPages := 20 }} | ||
{{ $morePages := true }} | ||
|
||
{{ range seq 1 $maxPages }} | ||
{{ if $morePages }} | ||
{{ $pagedUrl := printf "%s?page=%d&per_page=%d" $url . $perPage }} | ||
{{ with resources.GetRemote $pagedUrl (dict "headers" $headers) }} | ||
{{ with .Err }} | ||
{{ errorf "Unable to get remote resource %s: %s" $pagedUrl . }} | ||
{{ else }} | ||
{{ $pageData := . | transform.Unmarshal }} | ||
{{ $data = $data | append $pageData }} | ||
{{ if lt (len $pageData) $perPage }} | ||
{{ $morePages = false }} | ||
{{ end }} | ||
{{ end }} | ||
{{ else }} | ||
{{ errorf "Unable to get remote resource %s" $pagedUrl }} | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
|
||
|
||
{{/* Add pages and page resources. */}} | ||
{{ range $data }} | ||
|
||
{{/* Add page. */}} | ||
{{ $content := dict "mediaType" "text/markdown" "value" .description }} | ||
{{ $dates := dict "date" (time.AsTime .updated_at) }} | ||
{{ $heroUrl := printf "https://opengraph.githubassets.com/%s/%s" .default_branch .full_name }} | ||
{{ $repotags := (slice "Untagged") }} | ||
{{ if gt (len .topics) 0 }} | ||
{{ $repotags = .topics }} | ||
{{ end }} | ||
{{ $params := dict | ||
"owner" .owner | ||
"language" .language | ||
"homepage" .homepage | ||
"html_url" .html_url | ||
"repo-tags" $repotags | ||
"tags" (slice "Repos") | ||
"categories" (slice "Repos") | ||
"default_branch" .default_branch | ||
"heroUrl" $heroUrl | ||
}} | ||
{{ $page := dict | ||
"content" $content | ||
"dates" $dates | ||
"kind" "page" | ||
"params" $params | ||
"path" .node_id | ||
"title" .full_name | ||
}} | ||
{{ $.AddPage $page }} | ||
|
||
{{ end }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="tags"> | ||
<ul style="padding-left: 0;"> | ||
{{ range . }} | ||
{{ $url:= printf "repo-tags/%s/" . }} | ||
<li class="rounded"><a href="{{ $url | urlize | relLangURL }}" class="btn btn-sm btn-info">{{ . }}</a></li> | ||
{{ end }} | ||
</ul> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{ $context := .context }} | ||
{{ $taxo := .taxo }} | ||
{{ $class:= "" }} | ||
{{ if isset $context.Site.Taxonomies ( lower $taxo ) }} | ||
{{ $taxonomy := index $context.Site.Taxonomies ( lower $taxo ) }} | ||
{{ if (gt (len $taxonomy) 0)}} | ||
{{ range $taxonomy }} | ||
{{if eq $context.Title .Page.Title}} | ||
{{ $class = "active" }} | ||
{{else}} | ||
{{$class = ""}} | ||
{{end}} | ||
<li><a class="taxonomy-term {{ $class }}" href="{{ .Page.Permalink }}" data-taxonomy-term="{{ urlize .Page.Title }}"><span class="taxonomy-label">{{ .Page.Title }}</span></a></li> | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<div class="post-card repo-card"> | ||
<div class="card"> | ||
<div class="card-head"> | ||
<a href="{{ .RelPermalink | relLangURL }}" class="post-card-link"> | ||
<img class="card-img-top" src='{{ partial "helpers/get-hero.html" . }}' alt="Hero Image"> | ||
</a> | ||
</div> | ||
<div class="card-body"> | ||
<a href="{{ .RelPermalink | relLangURL }}" class="post-card-link"> | ||
<h5 class="card-title">{{ .Title }}</h5> | ||
<p class="card-text post-summary">{{ .Summary }}</p> | ||
</a> | ||
{{ if and site.Params.features.tags.enable site.Params.features.tags.on_card }} | ||
{{ partial "misc/repotags.html" (index .Params "repo-tags" ) }} | ||
{{ end }} | ||
</div> | ||
<div class="card-footer"> | ||
<span class="float-repot"> | ||
{{ .Date | time.Format ":date_full" }} | ||
{{ if site.Params.features.readingTime }} | {{.ReadingTime}} {{ i18n "minute" .ReadingTime }} {{ end }}</span> | ||
<a | ||
href="{{ .RelPermalink | relLangURL }}" | ||
class="float-end btn btn-outline-info btn-sm">{{ i18n "more" }}</a> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{{ define "navbar" }} | ||
{{ partial "navigators/navbar.html" . }} | ||
{{ end }} | ||
|
||
{{ define "sidebar" }} | ||
{{ $homePage:="#" }} | ||
{{ if hugo.IsMultilingual }} | ||
{{ $homePage = (path.Join (cond ( eq .Language.Lang "en") "" .Language.Lang) .Type) }} | ||
{{ end }} | ||
|
||
<section class="sidebar-section" id="sidebar-section"> | ||
<div class="sidebar-holder"> | ||
<div class="sidebar" id="sidebar"> | ||
<form class="mx-auto" method="get" action="{{ "search" | relLangURL }}"> | ||
<input type="text" name="keyword" value="" placeholder="{{ i18n "search" }}" data-search="" id="search-box" /> | ||
</form> | ||
<div class="sidebar-tree"> | ||
<ul class="tree"> | ||
<li style="padding-left: 0px !important;"><a href="{{ "repos" | relLangURL }}" data-filter="all">{{ i18n "repos" }}</a></li> | ||
</ul> | ||
</div> | ||
<div class="sidebar-tree"> | ||
<ul class="tree" id="tree"> | ||
<li id="list-heading">{{ i18n .Type }}</li> | ||
<div class="subtree taxonomy-terms"> | ||
{{ $context := . }} | ||
{{ partial "navigators/repo-taxonomies.html" (dict "context" $context "taxo" "repo-tags" "title" ( humanize "repos" ) ) }} | ||
</div> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{{ end }} | ||
|
||
{{ define "content" }} | ||
<section class="content-section" id="content-section"> | ||
<div class="content container-fluid" id="content"> | ||
<div class="container-fluid post-card-holder" id="post-card-holder"> | ||
{{ $posts := where .RegularPagesRecursive "Layout" "!=" "search" }} | ||
{{ $numShow := site.Params.features.pagination.maxPostsPerPage | default 12}} | ||
{{ $paginator := .Paginate $posts $numShow }} | ||
{{ range $paginator.Pages }} | ||
{{ if .Layout }} | ||
{{/* ignore the search.md file*/}} | ||
{{ else }} | ||
{{ partial "repocards/post.html" . }} | ||
{{ end }} | ||
{{ end }} | ||
</div> | ||
<div class="paginator"> | ||
{{ template "_internal/pagination.html" . }} | ||
</div> | ||
</div> | ||
</section> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{{ define "navbar" }} | ||
{{ partial "navigators/navbar.html" . }} | ||
{{ end }} | ||
|
||
{{ define "sidebar" }} | ||
{{ $homePage:="#" }} | ||
{{ if hugo.IsMultilingual }} | ||
{{ $homePage = (path.Join (cond ( eq .Language.Lang "en") "" .Language.Lang) .Type) }} | ||
{{ end }} | ||
|
||
<section class="sidebar-section" id="sidebar-section"> | ||
<div class="sidebar-holder"> | ||
<div class="sidebar" id="sidebar"> | ||
<form class="mx-auto" method="get" action="{{ "search" | relLangURL }}"> | ||
<input type="text" name="keyword" value="" placeholder="{{ i18n "search" }}" data-search="" id="search-box" /> | ||
</form> | ||
<div class="sidebar-tree"> | ||
<ul class="tree"> | ||
<li style="padding-left: 0px !important;"><a href="{{ .Type | relLangURL }}" data-filter="all">{{ i18n .Type }}</a></li> | ||
</ul> | ||
</div> | ||
<div class="sidebar-tree"> | ||
<ul class="tree" id="tree"> | ||
<li id="list-heading">{{ i18n "repo-tags" }}</li> | ||
<div class="subtree"> | ||
{{ partial "navigators/repo-taxonomies.html" (dict "context" . "taxo" "repo-tags" "title" ( humanize "tags" ) ) }} | ||
</div> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
{{ end }} | ||
|
||
{{ define "content" }} | ||
<section class="content-section" id="content-section"> | ||
<div class="content container-fluid" id="content"> | ||
<div class="container-fluid post-card-holder" id="post-card-holder repo-card-holder"> | ||
{{ $posts := where .RegularPagesRecursive "Layout" "!=" "search" }} | ||
{{ $numShow := site.Params.features.pagination.maxPostsPerPage | default 12}} | ||
{{ $paginator := .Paginate $posts $numShow }} | ||
{{ range $paginator.Pages }} | ||
{{ if .Layout }} | ||
{{/* ignore the search.md file*/}} | ||
{{ else }} | ||
{{ partial "repocards/post.html" . }} | ||
{{ end }} | ||
{{ end }} | ||
</div> | ||
<div class="paginator"> | ||
{{ template "_internal/pagination.html" . }} | ||
</div> | ||
</div> | ||
</section> | ||
{{ end }} |
Oops, something went wrong.