diff options
Diffstat (limited to 'themes/new_theme/layouts/partials/widgets')
9 files changed, 180 insertions, 26 deletions
diff --git a/themes/new_theme/layouts/partials/widgets/categories.html b/themes/new_theme/layouts/partials/widgets/categories.html index 7b93a4e..4998c44 100644 --- a/themes/new_theme/layouts/partials/widgets/categories.html +++ b/themes/new_theme/layouts/partials/widgets/categories.html @@ -1,16 +1,17 @@ -{{- if .Site.Params.widgets.categories }} -{{- if isset .Site.Taxonomies "categories" }} -{{- if not (eq (len .Site.Taxonomies.categories) 0) }} +{{- $categories := .Site.Taxonomies.categories }} +{{- if gt (len $categories) 0 }} <div class="widget-categories widget"> - <h4 class="widget__title">Categories</h4> + <h4 class="widget__title">{{ T "categories_title" }}</h4> <div class="widget__content"> <ul class="widget__list"> - {{- range $name, $items := .Site.Taxonomies.categories }} - <li class="widget__item"><a class="widget__link" href="{{ $.Site.BaseURL }}categories/{{ $name | urlize | lower }}">{{ $name | title }}</a></li> + {{- range $name, $taxonomy := $categories }} + {{- with $.Site.GetPage (printf "/categories/%s" $name) }} + <li class="widget__item"> + <a class="widget__link" href="{{ .RelPermalink }}">{{ .Title }}</a> + </li> {{- end }} + {{- end }} </ul> </div> </div> {{- end }} -{{- end }} -{{- end }} diff --git a/themes/new_theme/layouts/partials/widgets/elasticlunr_search.html b/themes/new_theme/layouts/partials/widgets/elasticlunr_search.html index 9fa5b34..5da7a2a 100644 --- a/themes/new_theme/layouts/partials/widgets/elasticlunr_search.html +++ b/themes/new_theme/layouts/partials/widgets/elasticlunr_search.html @@ -1,15 +1,13 @@ -{{- if .Site.Params.widgets.search }} <h4 class="widget__title">Search</h4> <div class="widget-search widget"> <form class="widget-search__form" role="search" method="get" action="/search/"> <label> - <span class="screen-reader-text">Search for:</span> - <input class="widget-search__field" type="search" autocomplete="off" placeholder="SEARCH..." value="" id="query" name="q"> + <input class="widget-search__field" type="search" autocomplete="off" placeholder="{{ T "search_placeholder" }}" value="" id="query" name="q" aria-label="{{ T "search_placeholder" }}"> </label> <input class="widget-search__submit" type="submit" value="Search"> </form> </div> -{{- if ( eq .URL "/search/" ) }} +{{- if ( eq .Permalink "/search/" ) }} <script language="Javascript"> $( window ).load( function( ) { var paramsString = window.location.search; @@ -21,6 +19,3 @@ } ); </script> {{- end }} -{{- end }} - - diff --git a/themes/new_theme/layouts/partials/widgets/fts5_search.html b/themes/new_theme/layouts/partials/widgets/fts5_search.html new file mode 100644 index 0000000..7f58e32 --- /dev/null +++ b/themes/new_theme/layouts/partials/widgets/fts5_search.html @@ -0,0 +1,21 @@ +<h4 class="widget__title">Search</h4> +<div class="widget-search widget"> + <form id="search_form" class="widget-search__form" role="search" method="get" action="/search/" onsubmit="return submitQuery( );"> + <label> + <input class="widget-search__field" type="search" autocomplete="off" placeholder="{{ T "search_placeholder" }}" value="" id="query" name="q" aria-label="{{ T "search_placeholder" }}"> + </label> + <input class="widget-search__submit" type="submit" value="Search"> + </form> +</div> +{{- if ( eq .Permalink "/search/" ) }} +<script language="Javascript"> + $( window ).load( function( ) { + var paramsString = window.location.search; + var searchParams = new URLSearchParams( paramsString ); + if( searchParams.has( "q" ) ) { + $( "#query" ).val( searchParams.get( "q" ) ); + $( "#query" ).removeAttr( "placeholder" ); + } + } ); +</script> +{{- end }} diff --git a/themes/new_theme/layouts/partials/widgets/languages.html b/themes/new_theme/layouts/partials/widgets/languages.html new file mode 100644 index 0000000..e54adb1 --- /dev/null +++ b/themes/new_theme/layouts/partials/widgets/languages.html @@ -0,0 +1,20 @@ +{{- $translations := .Site.Home.AllTranslations }} +{{- if and .Site.IsMultiLingual (gt (len $translations) 0) }} +<div class="widget-languages widget"> + <h4 class="widget__title">{{ T "languages_title" }}</h4> + <div class="widget__content"> + <ul class="widget__list"> + {{- range $translations }} + <li class="widget__item"> + <a class="widget-languages__link widget__link" href="{{ .RelPermalink }}"> + <span class="widget-languages__link-btn widget__link-btn btn">{{ .Language | upper }}</span> + {{- with .Language.LanguageName }} + <span class="widget-languages__link-text widget__link-text">{{ . | title | humanize }}</span> + {{- end }} + </a> + </li> + {{- end }} + </ul> + </div> +</div> +{{- end }}
\ No newline at end of file diff --git a/themes/new_theme/layouts/partials/widgets/recent.html b/themes/new_theme/layouts/partials/widgets/recent.html index 6aaee19..c264062 100644 --- a/themes/new_theme/layouts/partials/widgets/recent.html +++ b/themes/new_theme/layouts/partials/widgets/recent.html @@ -1,9 +1,12 @@ -{{- if .Site.Params.widgets.recent_articles }} +{{- $recent := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} +{{- $recent_num := (.Site.Params.widgets.recent_num | default 10) }} + +{{- if $recent }} <div class="widget-recent widget"> - <h4 class="widget__title">Recent Posts</h4> + <h4 class="widget__title">{{ T "recent_title" }}</h4> <div class="widget__content"> <ul class="widget__list"> - {{- range first 10 (where .Site.Pages "Section" "blog") }} + {{- range first $recent_num $recent }} <li class="widget__item"><a class="widget__link" href="{{ .RelPermalink }}">{{ .Title }}</a></li> {{- end }} </ul> diff --git a/themes/new_theme/layouts/partials/widgets/search.html b/themes/new_theme/layouts/partials/widgets/search.html new file mode 100644 index 0000000..d6b1652 --- /dev/null +++ b/themes/new_theme/layouts/partials/widgets/search.html @@ -0,0 +1,9 @@ +<div class="widget-search widget"> + <form class="widget-search__form" role="search" method="get" action="https://google.com/search"> + <label> + <input class="widget-search__field" type="search" placeholder="{{ T "search_placeholder" }}" value="" name="q" aria-label="{{ T "search_placeholder" }}"> + </label> + <input class="widget-search__submit" type="submit" value="Search"> + <input type="hidden" name="sitesearch" value="{{ .Site.BaseURL }}" /> + </form> +</div>
\ No newline at end of file diff --git a/themes/new_theme/layouts/partials/widgets/sidemenu.html b/themes/new_theme/layouts/partials/widgets/sidemenu.html new file mode 100644 index 0000000..2369233 --- /dev/null +++ b/themes/new_theme/layouts/partials/widgets/sidemenu.html @@ -0,0 +1,14 @@ +{{ if .Site.Menus.side }} +<div class="widget-sidemenu widget"> + <h4 class="widget__title">{{ T "sidemenu_title" }}</h4> + <nav class="widget__content"> + <ul class="widget__list"> + {{ range .Site.Menus.side }} + <li class="widget__item"> + <a class="widget__link" href="{{ .URL }}">{{ .Name }}</a> + </li> + {{ end }} + </ul> + </nav> +</div> +{{ end }}
\ No newline at end of file diff --git a/themes/new_theme/layouts/partials/widgets/social.html b/themes/new_theme/layouts/partials/widgets/social.html new file mode 100644 index 0000000..7f8faa9 --- /dev/null +++ b/themes/new_theme/layouts/partials/widgets/social.html @@ -0,0 +1,90 @@ +{{- if .Site.Params.widgets.social }} +<div class="widget-social widget"> + <h4 class="widget-social__title widget__title">{{ T "social_title" }}</h4> + <div class="widget-social__content widget__content"> + {{- with .Site.Params.widgets.social.facebook }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="Facebook" rel="noopener noreferrer" href="https://facebook.com/{{ . }}" target="_blank"> + {{ partial "svg/facebook.svg" (dict "class" "widget-social__link-icon") }} + <span>Facebook</span> + </a> + </div> + {{- end }} + {{- with .Site.Params.widgets.social.twitter }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="Twitter" rel="noopener noreferrer" href="https://twitter.com/{{ . }}" target="_blank"> + {{ partial "svg/twitter.svg" (dict "class" "widget-social__link-icon") }} + <span>Twitter</span> + </a> + </div> + {{- end }} + {{- with .Site.Params.widgets.social.instagram }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="Instagram" rel="noopener noreferrer" href="https://www.instagram.com/{{ . }}" target="_blank"> + {{ partial "svg/instagram.svg" (dict "class" "widget-social__link-icon") }} + <span>Instagram</span> + </a> + </div> + {{- end }} + {{- with .Site.Params.widgets.social.linkedin }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="LinkedIn" rel="noopener noreferrer" href="https://linkedin.com/in/{{ . }}" target="_blank"> + {{ partial "svg/linkedin.svg" (dict "class" "widget-social__link-icon") }} + <span>LinkedIn</span> + </a> + </div> + {{- end }} + {{- with .Site.Params.widgets.social.telegram }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="Telegram" rel="noopener noreferrer" href="https://t.me/{{ . }}" target="_blank"> + {{ partial "svg/telegram.svg" (dict "class" "widget-social__link-icon") }} + <span>Telegram</span> + </a> + </div> + {{- end }} + {{- with .Site.Params.widgets.social.github }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="GitHub" rel="noopener noreferrer" href="https://github.com/{{ . }}" target="_blank"> + {{ partial "svg/github.svg" (dict "class" "widget-social__link-icon") }} + <span>GitHub</span> + </a> + </div> + {{- end }} + {{- with .Site.Params.widgets.social.gitlab }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="GitLab" rel="noopener noreferrer" href="https://gitlab.com/{{ . }}" target="_blank"> + {{ partial "svg/gitlab.svg" (dict "class" "widget-social__link-icon") }} + <span>GitLab</span> + </a> + </div> + {{- end }} + {{- with .Site.Params.widgets.social.bitbucket }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="Bitbucket" rel="noopener noreferrer" href="https://bitbucket.org/{{ . }}" target="_blank"> + {{ partial "svg/bitbucket.svg" (dict "class" "widget-social__link-icon") }} + <span>Bitbucket</span> + </a> + </div> + {{- end }} + {{- with .Site.Params.widgets.social.email }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="Email" href="mailto:{{ . }}"> + {{ partial "svg/email.svg" (dict "class" "widget-social__link-icon") }} + <span>{{ . }}</span> + </a> + </div> + {{- end }} + + {{ range .Site.Params.widgets.social.custom }} + <div class="widget-social__item widget__item"> + <a class="widget-social__link widget__link btn" title="{{ .title }}" rel="noopener noreferrer" href="{{ .url }}" target="_blank"> + {{- if .icon }} + {{ partial .icon (dict "class" "widget-social__link-icon") }} + {{- end }} + <span>{{ .title }}</span> + </a> + </div> + {{ end }} + </div> +</div> +{{- end }}
\ No newline at end of file diff --git a/themes/new_theme/layouts/partials/widgets/taglist.html b/themes/new_theme/layouts/partials/widgets/taglist.html index 966205a..9b6046b 100644 --- a/themes/new_theme/layouts/partials/widgets/taglist.html +++ b/themes/new_theme/layouts/partials/widgets/taglist.html @@ -1,14 +1,15 @@ -{{- if .Site.Params.widgets.tags }} -{{- if isset .Site.Taxonomies "tags" }} -{{- if not (eq (len .Site.Taxonomies.tags) 0) }} +{{- $tags := .Site.Taxonomies.tags }} +{{- if gt (len $tags) 0 }} <div class="widget-taglist widget"> - <h4 class="widget__title">Tags</h4> + <h4 class="widget__title">{{ T "tags_title" }}</h4> <div class="widget__content"> - {{- range $name, $items := .Site.Taxonomies.tags }} - <a class="widget__link widget__link--taglist" href="{{ $.Site.BaseURL }}tags/{{ $name | urlize | lower }}" title="{{ $name }}">{{ $name }}</a> + {{- range $name, $taxonomy := $tags }} + {{- with $.Site.GetPage (printf "/tags/%s" $name) }} + <a class="widget-taglist__link widget__link btn" href="{{ .RelPermalink }}" title="{{ .Title }}"> + {{- .Title -}}{{- if .Site.Params.widgets.tags_counter }} ({{ $taxonomy.Count }}){{ end -}} + </a> {{- end }} + {{- end }} </div> </div> {{- end }} -{{- end }} -{{- end }}
\ No newline at end of file |