-
Notifications
You must be signed in to change notification settings - Fork 6
Add blog section with summary display on listing page #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bits-and-atoms
wants to merge
21
commits into
snapcrafters:main
Choose a base branch
from
bits-and-atoms:dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a419c76
Add blog section with summary display on listing page :: Created cont…
bits-and-atoms fbfb57d
added new line to each files and removed test files
bits-and-atoms d5ff76b
Merge branch 'snapcrafters:main' into dev
bits-and-atoms d289510
Basic structure creation for single blog page
bits-and-atoms 4f9474d
added breadcrumb navigation for a single blog page
bits-and-atoms fd17897
adding vanilla framework for breadcrumb navigation
bits-and-atoms 3f814e3
adding meta data of blog
bits-and-atoms 1b8aee5
adding author data
bits-and-atoms c1018d1
table of content added styling is remaining
bits-and-atoms 0693253
bottom navigation for blog added without styling
bits-and-atoms e364624
incorporating features to single blog page
bits-and-atoms 3d55743
adding new line at end of files
bits-and-atoms b067f2a
Delete assets/css/breadcrumbs.css
bits-and-atoms 2477f99
adding emojify
bits-and-atoms 95d9fb5
changing title
bits-and-atoms 3e25052
adding list page with necessary objects
bits-and-atoms 9926d5b
meta data file for list page of blog
bits-and-atoms edf7141
minor bug fixes
bits-and-atoms 11ed6d4
adding tag taxonomy
bits-and-atoms 3a00367
Merge branch 'snapcrafters:main' into dev
bits-and-atoms 0d01daa
styling of blog list,term and single page done
bits-and-atoms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| title: "Blogs" | ||
| description: "Latest updates and articles" | ||
| DisplayBreadCrumbs: true | ||
| --- | ||
This file contains hidden or 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 hidden or 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,60 @@ | ||
| {{- define "main" }} | ||
| <div class="blog-list-container"> | ||
| {{- if not .IsHome | and .Title }} | ||
| <header class="blog-header"> | ||
| {{ partial "breadcrumbs-for-tags.html" . }} | ||
| <h1 class="blog-page-title">{{ .Title }}</h1> | ||
| {{- if .Description }} | ||
| <div class="blog-page-description"> | ||
| {{ .Description | markdownify | emojify | safeHTML}} | ||
| </div> | ||
| {{- end }} | ||
| </header> | ||
| {{- end }} | ||
|
|
||
| {{- if .Content }} | ||
| <div class="blog-content"> | ||
| {{ .Content }} | ||
| </div> | ||
| {{- end }} | ||
|
|
||
| {{- $pages := slice }} | ||
| {{- if .IsHome }} | ||
| {{- $sections := site.Params.mainSections | default (slice "tags") }} | ||
| {{- range site.RegularPages }} | ||
| {{- if (and (in $sections .Section) (not .Params.hiddenInHomeList)) }} | ||
| {{- $pages = $pages | append . }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- else }} | ||
| {{- $pages = .RegularPages }} | ||
| {{- end }} | ||
|
|
||
| {{- $paginator := .Paginate $pages }} | ||
|
|
||
| {{- range $paginator.Pages }} | ||
| <article class="blog-card"> | ||
| <a class="blog-card-link-wrapper" href="{{ .Permalink }}"> | ||
| <header class="blog-card-header"> | ||
| <h2 class="blog-card-title"> | ||
| {{ .Title | emojify | safeHTML }} | ||
| {{- if .Draft }} <span class="draft-badge">[Draft]</span> {{- end }} | ||
| </h2> | ||
| </header> | ||
|
|
||
| {{- if not .Params.hideSummary }} | ||
| <div class="blog-card-summary"> | ||
| <p>{{ .Summary | plainify | htmlUnescape | emojify | truncate 250 | safeHTML}}{{ if .Truncated }}...{{ end }}</p> | ||
| </div> | ||
| {{- end }} | ||
|
|
||
| {{- if not .Params.hideMeta }} | ||
| <footer class="blog-card-meta"> | ||
| {{- partial "blog-only-date.html" . }} | ||
| </footer> | ||
| {{- end }} | ||
| </a> | ||
| </article> | ||
| {{- end }} | ||
| </div> | ||
| {{- end }} |
This file contains hidden or 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,60 @@ | ||
| {{- define "main" }} | ||
| <div class="blog-list-container"> | ||
| {{- if not .IsHome | and .Title }} | ||
| <header class="blog-header"> | ||
| {{ partial "breadcrumbs.html" . }} | ||
| <h1 class="blog-page-title">{{ .Title }}</h1> | ||
| {{- if .Description }} | ||
| <div class="blog-page-description"> | ||
| {{ .Description | markdownify | emojify | safeHTML}} | ||
| </div> | ||
| {{- end }} | ||
| </header> | ||
| {{- end }} | ||
|
|
||
| {{- if .Content }} | ||
| <div class="blog-content"> | ||
| {{ .Content | markdownify | emojify | safeHTML}} | ||
| </div> | ||
| {{- end }} | ||
|
|
||
| {{- $pages := slice }} | ||
| {{- if .IsHome }} | ||
| {{- $sections := site.Params.mainSections | default (slice "blogs") }} | ||
| {{- range site.RegularPages }} | ||
| {{- if (and (in $sections .Section) (not .Params.hiddenInHomeList)) }} | ||
| {{- $pages = $pages | append . }} | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- else }} | ||
| {{- $pages = .RegularPages }} | ||
| {{- end }} | ||
|
|
||
| {{- $paginator := .Paginate $pages }} | ||
|
|
||
| {{- range $paginator.Pages }} | ||
| <article class="blog-card"> | ||
| <a class="blog-card-link-wrapper" href="{{ .Permalink }}"> | ||
| <header class="blog-card-header"> | ||
| <h2 class="blog-card-title"> | ||
| {{ .Title | emojify | safeHTML }} | ||
| {{- if .Draft }} <span class="draft-badge">[Draft]</span> {{- end }} | ||
| </h2> | ||
| </header> | ||
|
|
||
| {{- if not .Params.hideSummary }} | ||
| <div class="blog-card-summary"> | ||
| <p>{{ .Summary | plainify | htmlUnescape | emojify | truncate 250 | safeHTML}}{{ if .Truncated }}...{{ end }}</p> | ||
| </div> | ||
| {{- end }} | ||
|
|
||
| {{- if not .Params.hideMeta }} | ||
| <footer class="blog-card-meta"> | ||
| {{- partial "blog-only-date.html" . }} | ||
| </footer> | ||
| {{- end }} | ||
| </a> | ||
| </article> | ||
| {{- end }} | ||
| </div> | ||
| {{- end }} |
This file contains hidden or 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,43 @@ | ||
| {{- define "main" }} | ||
| <div class="blog-single-container"> | ||
| <div class=""> | ||
| <article class=""> | ||
| <header class="blog-header"> | ||
| {{ partial "breadcrumbs.html" . }} | ||
| <h1 class="blog-page-title"> | ||
| {{ .Title | emojify | safeHTML}} | ||
| </h1> | ||
| {{- if (.Param "DisplayMeta") }} | ||
| <div class="blog-meta"> | ||
| {{- partial "blog-meta.html" . -}} | ||
| </div> | ||
| {{- end }} | ||
| {{- if (.Param "DisplayCanonicalLink") }} | ||
| <div class=""> | ||
| {{- partial "blog-canonical.html" . -}} | ||
| </div> | ||
| {{- end }} | ||
| </header> | ||
| {{- if (.Param "ShowToc") }} | ||
| {{- partial "blog-table-of-content.html" . }} | ||
| {{- end }} | ||
| {{- if .Content }} | ||
| <div class=""> | ||
| {{ .Content | emojify | safeHTML}} | ||
| </div> | ||
| {{- end }} | ||
| <footer class="blog-footer"> | ||
| {{- $tags := "tags" }} | ||
| <ul class="tag-list"> | ||
| {{- range ($.GetTerms $tags) }} | ||
| <li class="tag-card"><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> | ||
| {{- end }} | ||
| </ul> | ||
| {{- if (.Param "ShowFooterNav") }} | ||
| {{- partial "blog-footer-nav.html" . }} | ||
| {{- end }} | ||
| </footer> | ||
| </article> | ||
| </div> | ||
| </div> | ||
| {{- end }} |
This file contains hidden or 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,10 @@ | ||
| {{- if (or .Params.author site.Params.author) -}} | ||
| {{- $author := (.Params.author | default site.Params.author) -}} | ||
| {{- $authorType := printf "%T" $author -}} | ||
|
|
||
| {{- if (or (eq $authorType "[]string") (eq $authorType "[]interface {}")) -}} | ||
| {{- delimit $author ", " -}} | ||
| {{- else -}} | ||
| {{- $author -}} | ||
| {{- end -}} | ||
| {{- end -}} |
This file contains hidden or 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 @@ | ||
| {{ if and (.Params.CanonicalLink) (.Params.DisplayCanonicalLink ) -}} | ||
| {{ $url := urls.Parse .Params.CanonicalLink }} | ||
|
|
||
| <span class="blog-canonical"> | ||
| {{- (site.Params.CanonicalLinkText | default .Params.CanonicalLinkText) | default "Read more at" -}} | ||
| <a href="{{ trim .Params.CanonicalLink " " }}" title="{{ trim .Params.CanonicalLink " " }}" target="_blank" rel="noopener noreferrer">{{ $url.Host }}</a> | ||
| </span> | ||
| {{- end }} |
This file contains hidden or 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,20 @@ | ||
| {{- $filteredPages := where site.RegularPages "Type" "in" site.Params.mainSections }} | ||
| {{- if and (gt (len $filteredPages) 1) (in $filteredPages .) }} | ||
| <nav class="footer-nav-card"> | ||
| {{- with $filteredPages.Next . }} | ||
| <a class="footer-nav-link footer-nav-prev" href="{{ .Permalink }}"> | ||
| <span class="footer-nav-text">{{ i18n "prev_page" }}</span> | ||
| <br> | ||
| <span class="footer-nav-title">{{ .Name | truncate 30 }}</span> | ||
| </a> | ||
| {{- end }} | ||
|
|
||
| {{- with $filteredPages.Prev . }} | ||
| <a class="footer-nav-link footer-nav-next" href="{{ .Permalink }}"> | ||
| <span class="footer-nav-text">{{ i18n "next_page" }}</span> | ||
| <br> | ||
| <span class="footer-nav-title">{{ .Name | truncate 30 }}</span> | ||
| </a> | ||
| {{- end }} | ||
| </nav> | ||
| {{- end }} |
This file contains hidden or 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 @@ | ||
| {{- $scratch := newScratch }} | ||
|
|
||
| {{- if not .Date.IsZero -}} | ||
| {{- $dateFormatted := printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default "January 2, 2006" site.Params.DateFormat)) }} | ||
| {{- $scratch.Add "meta" (slice $dateFormatted) }} | ||
| {{- end -}} | ||
|
|
||
| {{- if (.Param "ReadingTime") -}} | ||
| {{- $readingTime := i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime) }} | ||
| {{- $scratch.Add "meta" (slice $readingTime) }} | ||
| {{- end -}} | ||
|
|
||
| {{- if (.Param "WordCount") -}} | ||
| {{- $wordCount := i18n "words" .WordCount | default (printf "%d words" .WordCount) }} | ||
| {{- $scratch.Add "meta" (slice $wordCount) }} | ||
| {{- end -}} | ||
|
|
||
| {{- if not (.Param "HideAuthor") -}} | ||
| {{- with (partial "blog-author.html" .) }} | ||
| {{- $scratch.Add "meta" (slice .) }} | ||
| {{- end -}} | ||
| {{- end -}} | ||
|
|
||
| {{- with ($scratch.Get "meta") -}} | ||
| {{- delimit . " · " | safeHTML -}} | ||
| {{- end -}} |
This file contains hidden or 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,4 @@ | ||
| {{- $scratch := newScratch }} | ||
| {{- if not .Date.IsZero -}} | ||
| <span title="{{ .Date }}">{{ .Date | time.Format "January 2, 2006 15:04" }}</span> | ||
| {{- end -}} |
This file contains hidden or 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,39 @@ | ||
| {{- $headers := findRE "<h[1-6].*?>(.|\n])+?</h[1-6]>" .Content -}} | ||
| {{- $has_headers := ge (len $headers) 1 -}} | ||
| {{- if $has_headers -}} | ||
| <div class="toc-card"> | ||
| <details {{ if (.Param "DefaultOpenTOC" ) }} open{{ end }}> | ||
| <summary accesskey="z"> | ||
| <span class="toc-title">{{ "Table of Contents" }}</span> | ||
| </summary> | ||
|
|
||
| <div class="toc-content"> | ||
| {{- $headerLevels := slice -}} | ||
| {{- $.Scratch.Set "currentLevel" 1 -}} | ||
|
|
||
| <ul class="toc-list"> | ||
| {{- range $i, $header := $headers -}} | ||
| {{- $headerLevel := len (seq (index (findRE "[1-6]" . 1) 0)) -}} | ||
| {{- $cleanedID := replaceRE ".*id=\"([^\"]+)\".*" "$1" $header -}} | ||
| {{- if lt $headerLevel ($.Scratch.Get "currentLevel") }} | ||
| </ul> | ||
| {{- else if gt $headerLevel ($.Scratch.Get "currentLevel") }} | ||
| <ul> | ||
| {{- end -}} | ||
|
|
||
| <li class="toc-item"> | ||
| <a href="#{{- $cleanedID }}" aria-label="{{- $header | plainify | safeHTML }}"> | ||
| {{- $header | plainify | safeHTML }} | ||
| </a> | ||
| </li> | ||
|
|
||
| {{- $.Scratch.Set "currentLevel" $headerLevel -}} | ||
| {{- end -}} | ||
| {{- range seq ($.Scratch.Get "currentLevel") 1 -}} | ||
| </ul> | ||
| {{- end -}} | ||
| </ul> | ||
| </div> | ||
| </details> | ||
| </div> | ||
| {{- end }} |
This file contains hidden or 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,22 @@ | ||
| <div class="breadcrumbs"> | ||
| {{- $url := replace .Permalink (printf "%s" site.Home.Permalink) "" -}} | ||
| {{- $lang_url := strings.TrimPrefix (printf "%s/" .Lang) $url -}} | ||
|
|
||
| <a href="{{ "" | absLangURL }}"> | ||
| {{ i18n "home" | default "Home" }} | ||
| </a> | ||
|
|
||
| {{- $scratch := newScratch -}} | ||
| {{- range $index, $element := split $lang_url "/" -}} | ||
| {{- if and (ne $element "tags") (gt (len $element) 0) -}} | ||
| {{- $scratch.Add "path" (printf "%s/" $element ) -}} | ||
| {{- $bc_pg := site.GetPage ($scratch.Get "path") -}} | ||
| {{- if $bc_pg -}} | ||
| {{- print " " | safeHTML -}} | ||
| <a href="{{ $bc_pg.Permalink }}"> | ||
| {{ $bc_pg.Name }} | ||
| </a> | ||
| {{- end -}} | ||
| {{- end -}} | ||
| {{- end -}} | ||
| </div> |
This file contains hidden or 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,22 @@ | ||
| {{- if (.Param "DisplayBreadCrumbs") -}} | ||
| <div class="breadcrumbs"> | ||
| {{- $url := replace .Permalink (printf "%s" site.Home.Permalink) "" -}} | ||
| {{- $lang_url := strings.TrimPrefix (printf "%s/" .Lang) $url -}} | ||
|
|
||
| <a href="{{ "" | absLangURL }}"> | ||
| {{ i18n "home" | default "Home" }} | ||
| </a> | ||
|
|
||
| {{- $scratch := newScratch -}} | ||
| {{- range $index, $element := split $lang_url "/" -}} | ||
| {{- $scratch.Add "path" (printf "%s" $element ) -}} | ||
| {{- $bc_pg := site.GetPage ($scratch.Get "path") -}} | ||
| {{- if (and ($bc_pg) (gt (len . ) 0)) -}} | ||
| {{- print " " | safeHTML -}} | ||
| <a href="{{ $bc_pg.Permalink }}"> | ||
| {{ $bc_pg.Name }} | ||
| </a> | ||
| {{- end -}} | ||
| {{- end -}} | ||
| </div> | ||
| {{- end -}} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.