-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix preview rendering for videos and same published/updated dates (#…
…771) * Remove microcopy preventing previews from working * Fix showing last updated on posts if it's the same as published * Add reading time to posts * Pass in microcopy * Add reading time microcopy --------- Co-authored-by: Sam Richard <[email protected]>
- Loading branch information
Showing
7 changed files
with
73 additions
and
13 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,24 @@ | ||
<script lang="ts"> | ||
import readingTime from 'reading-time'; | ||
import { toPlainText } from 'astro-portabletext/utils'; | ||
import type { PortableTextBlock } from '@sanity/types'; | ||
export let body: PortableTextBlock[]; | ||
export let label = 'Reading time'; | ||
export let duration = `((n)) minutes`; | ||
export let wrapper = 'div'; | ||
const { minutes } = readingTime(toPlainText(body)); | ||
const length = duration.replace('((n))', `${Math.ceil(minutes)}`); | ||
</script> | ||
|
||
<svelte:element this={wrapper} class="extras-section"> | ||
<h4 class="type--label">{label}</h4> | ||
<p class="type--h6">{length}</p> | ||
</svelte:element> | ||
|
||
<style> | ||
.type--h6 { | ||
font-weight: 400; | ||
} | ||
</style> |
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