Skip to content
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

experimental: View Transition on Navigation #1010

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion layouts/_default/section.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h2 class="single-title animate__animated animate__pulse animate__faster">
<h3 class="group-title">{{ .Key }}</h3>
{{- range .Pages -}}
<article class="archive-item">
<a href="{{ .RelPermalink }}" class="archive-item-link">
<a href="{{ .RelPermalink }}" class="archive-item-link" style="view-transition-name: {{ (replaceRE "[^A-Za-z0-9]" "" .Title) | safeCSS}}">
{{- .Title -}}
</a>
<span class="archive-item-date">
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/summary.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{- with $image -}}
<div class="featured-image-preview">
<a href="{{ $.RelPermalink }}" aria-label={{ $.Title }}>
{{- dict "Src" . "Title" $.Description "Resources" $.Resources "Height" $height "Width" $width "Loading" "eager" | partial "plugin/image.html" -}}
{{- dict "Src" . "Title" $.Description "Resources" $.Resources "Height" $height "Width" $width "Loading" "eager" "ViewTransitionName" (printf "featured-image-%v" (replaceRE "[^A-Za-z0-9]" "" $.Title) | safeCSS) | partial "plugin/image.html" -}}
</a>
</div>
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{{- /* Posts */ -}}
{{- if ne $posts.enable false | and .Site.RegularPages -}}
{{- /* Paginate */ -}}
{{- $pages := where .Site.RegularPages "Type" "posts" -}}
{{- $pages := where .Site.RegularPages "Type" "in" site.Params.mainSections -}}
{{- if .Site.Params.page.hiddenFromHomePage -}}
{{- $pages = where $pages "Params.hiddenfromhomepage" false -}}
{{- else -}}
Expand Down
2 changes: 1 addition & 1 deletion layouts/index.rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{- range where .Site.RegularPages "Type" "posts" | first (.Site.Params.home.rss | default 10) -}}
{{- range where .Site.RegularPages "Type" "in" site.Params.mainSections | first (.Site.Params.home.rss | default 10) -}}
{{- dict "Page" . "Site" .Site | partial "rss/item.html" -}}
{{- end -}}
</channel>
Expand Down
1 change: 1 addition & 0 deletions layouts/partials/head/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<meta name="apple-mobile-web-app-title" content="{{ .Site.Params.app.title | default .Site.Title }}">

<meta name="theme-color" content="#f8f8f8">
<meta name="view-transition" content="same-origin" />

{{- with .Site.Params.app.tileColor -}}
<meta name="msapplication-TileColor" content="{{ . }}">
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{{- with .Page -}}
{{- $url = .RelPermalink -}}
{{- end -}}
<a class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}" href="{{ $url }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }}>
<a class="menu-item{{ if $.IsMenuCurrent `main` . | or ($.HasMenuCurrent `main` .) | or (eq $.RelPermalink $url) }} active{{ end }}" href="{{ $url }}"{{ with .Title }} title="{{ . }}"{{ end }}{{ if (urls.Parse $url).Host }} rel="noopener noreferrer" target="_blank"{{ end }} style="view-transition-name: menu-item-{{ .Name | safeCSS }}">
{{- .Pre | safeHTML }} {{ .Name }} {{ .Post | safeHTML -}}
</a>
{{- end -}}
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/plugin/image.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
src="{{ $src | safeURL }}"
srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
sizes="auto"
{{ with .ViewTransitionName }}style="view-transition-name: {{ . | safeCSS }};"{{ end }}
alt="{{ $alt }}"{{ with $height }} height="{{ . }}" {{ end }}{{ with $width }} width="{{ . }}" {{ end }}>
</a>
{{- else -}}
Expand All @@ -53,5 +54,5 @@
srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x"
sizes="auto"
alt="{{ $alt }}"
title="{{ .Title | default $alt }}"{{ with $height }} height="{{ . }}" {{ end }} {{ with $width }} width="{{ . }}" {{ end }}>
title="{{ .Title | default $alt }}"{{ with $height }} height="{{ . }}" {{ end }} {{ with $width }} width="{{ . }}" {{ end }}{{ with .ViewTransitionName }}style="view-transition-name: {{ . | safeCSS }};"{{ end }}>
{{- end -}}
4 changes: 2 additions & 2 deletions layouts/posts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h2 class="toc-title">{{ T "contents" }}</h2>

<article class="page single">
{{- /* Title */ -}}
<h1 class="single-title animate__animated animate__flipInX">{{ .Title }}</h1>
<h1 class="single-title" style="view-transition-name: {{ (replaceRE "[^A-Za-z0-9]" "" .Title) | safeCSS}}">{{ .Title }}</h1>

{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}
Expand Down Expand Up @@ -164,7 +164,7 @@ <h2 class="single-subtitle">{{ . }}</h2>
{{- end -}}
{{- with $image -}}
<div class="featured-image">
{{- dict "Src" . "Title" $.Description "Resources" $.Resources "Width" $width "Height" $height "Loading" "eager" | partial "plugin/image.html" -}}
{{- dict "Src" . "Title" $.Description "Resources" $.Resources "Width" $width "Height" $height "Loading" "eager" "ViewTransitionName" (printf "featured-image-%v" (replaceRE "[^A-Za-z0-9]" "" $.Title) | safeCSS) | partial "plugin/image.html" -}}
</div>
{{- end -}}
{{- /* Series list */ -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/shortcodes/showcase.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<div class="showcase-box column-{{ $column }}">
<div class="showcase-image">
<a href={{ $link }}>
{{- dict "Src" $image "Height" "200" "Width" "400" "Title" $title | partial "plugin/image.html" -}}
{{- dict "Src" $image "Height" "200" "Width" "400" "Title" $title "ViewTransitionName" (printf "featured-image-%v" (replaceRE "[^A-Za-z0-9]" "" $title) | safeCSS) | partial "plugin/image.html" -}}
</a>
</div>
<h2 class="showcase-title">
<h2 class="showcase-title" style="view-transition-name: {{ (replaceRE "[^A-Za-z0-9]" "" $title) | safeCSS }}">
<a href={{ $link }}>{{ $title }}</a>
</h2>
<p class="showcase-summary">
Expand Down
Loading