diff options
author | tdro <tdro@noreply.example.com> | 2023-09-10 09:15:05 -0400 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2023-09-10 09:15:05 -0400 |
commit | 4386b685505b0142b46a29b097dd5340b5bcfb8c (patch) | |
tree | 7c17a9fe7ca6db29abe886461121d1b8db901d40 /themes/default/layouts | |
parent | 491546bf0f9170bbca53fc9543e4b74ed7207f37 (diff) | |
download | canory-4386b685505b0142b46a29b097dd5340b5bcfb8c.tar.gz canory-4386b685505b0142b46a29b097dd5340b5bcfb8c.tar.bz2 canory-4386b685505b0142b46a29b097dd5340b5bcfb8c.zip |
themes/default/layouts/partials/profile-tabs: Anchor tabs
Add absolute scroll target offset if browser supports it
Diffstat (limited to 'themes/default/layouts')
7 files changed, 44 insertions, 13 deletions
diff --git a/themes/default/layouts/_default/section.drafts.html b/themes/default/layouts/_default/section.drafts.html index e7d56a1..7a2cdf6 100644 --- a/themes/default/layouts/_default/section.drafts.html +++ b/themes/default/layouts/_default/section.drafts.html @@ -4,7 +4,7 @@ <style> {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} - tab-bar a[href="{{ .Site.BaseURL }}/{{ $author }}/drafts/"] { + tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/drafts"] { color: #111; color: var(--foreground); font-weight: 700; diff --git a/themes/default/layouts/_default/section.feeds.html b/themes/default/layouts/_default/section.feeds.html index 30ef7ed..406f667 100644 --- a/themes/default/layouts/_default/section.feeds.html +++ b/themes/default/layouts/_default/section.feeds.html @@ -4,7 +4,7 @@ <style> {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} - tab-bar a[href="{{ .Site.BaseURL }}/{{ $author }}/feeds/"] { + tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/feeds"] { color: #111; color: var(--foreground); font-weight: 700; diff --git a/themes/default/layouts/_default/section.html b/themes/default/layouts/_default/section.html index ba4c133..4de0f9c 100644 --- a/themes/default/layouts/_default/section.html +++ b/themes/default/layouts/_default/section.html @@ -3,6 +3,7 @@ {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} tab-bar a[href="{{ .CurrentSection.Permalink }}"], + tab-bar a[href^="{{ .CurrentSection.Permalink }}#"], tab-bar a[href="{{ strings.TrimRight "/" .CurrentSection.Permalink }}"] { color: #111; color: var(--foreground); diff --git a/themes/default/layouts/_default/section.likes.html b/themes/default/layouts/_default/section.likes.html index 130765a..5626344 100644 --- a/themes/default/layouts/_default/section.likes.html +++ b/themes/default/layouts/_default/section.likes.html @@ -4,7 +4,7 @@ <style> {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} - tab-bar a[href="{{ .Site.BaseURL }}/{{ $author }}/likes/"] { + tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/likes"] { color: #111; color: var(--foreground); font-weight: 700; diff --git a/themes/default/layouts/_default/section.media.html b/themes/default/layouts/_default/section.media.html index 5c2c05e..d591934 100644 --- a/themes/default/layouts/_default/section.media.html +++ b/themes/default/layouts/_default/section.media.html @@ -4,7 +4,7 @@ <style> {{ partial "navigator.css.html" (dict "Link" "/") | safeCSS }} - tab-bar a[href="{{ .Site.BaseURL }}/{{ $author }}/media/"] { + tab-bar a[href^="{{ "" | absURL }}/{{ $author }}/media"] { color: #111; color: var(--foreground); font-weight: 700; diff --git a/themes/default/layouts/partials/profile-tabs.html b/themes/default/layouts/partials/profile-tabs.html index 5da84e9..ec87076 100644 --- a/themes/default/layouts/partials/profile-tabs.html +++ b/themes/default/layouts/partials/profile-tabs.html @@ -1,14 +1,44 @@ {{- $author := partial "function-authors-data.html" . -}} -{{- $label := "" -}} +{{- $path := print ("" | absURL) "/" $author.user -}} <tab-bar> <nav> - <a data-label="{{ $label = "Posts" }}{{ $label }}" href="{{ .Site.BaseURL }}/{{ $author.user }}/">{{ $label }}</a> - <a data-label="{{ $label = "Feeds" }}{{ $label }}" href="{{ .Site.BaseURL }}/{{ $author.user }}/feeds/">{{ $label }}</a> - <a data-label="{{ $label = "Media" }}{{ $label }}" href="{{ .Site.BaseURL }}/{{ $author.user }}/media/">{{ $label }}</a> - <a data-label="{{ $label = "Likes" }}{{ $label }}" href="{{ .Site.BaseURL }}/{{ $author.user }}/likes/">{{ $label }}</a> - {{- if .Site.BuildDrafts }} - <a data-label="{{ $label = "Drafts" }}{{ $label }}" href="{{ .Site.BaseURL }}/{{ $author.user }}/drafts/" data-draft="" >{{ $label }}</a> + <a + data-label="{{ $label := "Posts" }}{{ $label }}" + href="{{ $path }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> + + <a + data-label="{{ $label := "Feeds" }}{{ $label }}" + href="{{ $path }}/{{ lower $label }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> + + <a + data-label="{{ $label := "Media" }}{{ $label }}" + href="{{ $path }}/{{ lower $label }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> + + <a + data-label="{{ $label := "Likes" }}{{ $label }}" + href="{{ $path }}/{{ lower $label }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> + + {{- if $.Site.BuildDrafts }} + <a + data-draft="" + data-label="{{ $label := "Drafts" }}{{ $label }}" + href="{{ $path }}/{{ lower $label }}/#{{ lower $label }}"> + {{ $label }} + <span data-scroll="" id="{{ lower $label }}"></span> + </a> {{- end }} </nav> </tab-bar> diff --git a/themes/default/layouts/partials/profile.html b/themes/default/layouts/partials/profile.html index 2043e49..5d431e0 100644 --- a/themes/default/layouts/partials/profile.html +++ b/themes/default/layouts/partials/profile.html @@ -37,6 +37,6 @@ <span><b>{{ with $author.feeds.rss }}{{ len . }}{{ else }} 0 {{ end }}</b> Following</span> </p> </footer> - - {{ partial "profile-tabs.html" . }} </micro-header> + +{{- partial "profile-tabs.html" . -}} |