-
-
Notifications
You must be signed in to change notification settings - Fork 258
docs: change homepage headings #1256
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
06eb360
docs: update homepage headings
jderochervlk 2702a33
shorten H1
jderochervlk a360e08
break up frontpage text
jderochervlk b6ad9ae
fix casing
jderochervlk cb11975
switch to red hat mono
jderochervlk a694919
update page description
jderochervlk ed832d4
update meta component to trim description
jderochervlk ef2ac39
docs: add meta description shortening design
jderochervlk eaa1c93
fix: shorten social meta descriptions
jderochervlk de565b0
format
jderochervlk eeda090
remove planning docs
jderochervlk 2daed17
shorten ogDescription as well
jderochervlk a68b7ed
shorten description right away
jderochervlk f2a2a64
fix function name
jderochervlk 2a11718
chore: ignore local worktrees directory
jderochervlk 18139c2
use first sentence as subtitle
jderochervlk e176f2f
improve ogimage
jderochervlk 703fa7f
more og image tweaks
jderochervlk 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
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,56 @@ | ||
| open Vitest | ||
|
|
||
| test("returns the first sentence for a one-sentence description", async () => { | ||
| let result = MetaDescription.shortenForSocialPreview("JavaScript Made Simple for Humans and AI.") | ||
|
|
||
| expect(result)->toBe("JavaScript Made Simple for Humans and AI.") | ||
| }) | ||
|
|
||
| test("includes the second sentence when both sentences are within 140 characters", async () => { | ||
| let result = MetaDescription.shortenForSocialPreview( | ||
| "JavaScript Made Simple for Humans and AI. ReScript is a strongly typed language that compiles to clean, efficient JavaScript that humans and AI tools can read and understand.", | ||
| ) | ||
|
|
||
| expect(result)->toBe( | ||
| "JavaScript Made Simple for Humans and AI. ReScript is a strongly typed language that compiles to clean, efficient JavaScript that humans and AI tools can read and understand.", | ||
| ) | ||
| }) | ||
|
|
||
| test("returns only the first sentence when the first sentence exceeds 140 characters", async () => { | ||
| let result = MetaDescription.shortenForSocialPreview( | ||
| "This first sentence is intentionally long enough to cross the one hundred and forty character threshold before it reaches its final word in the sentence. Short follow up.", | ||
| ) | ||
|
|
||
| expect(result)->toBe( | ||
| "This first sentence is intentionally long enough to cross the one hundred and forty character threshold before it reaches its final word in the sentence.", | ||
| ) | ||
| }) | ||
|
|
||
| test( | ||
| "returns only the first sentence when the second sentence exceeds 140 characters", | ||
| async () => { | ||
| let result = MetaDescription.shortenForSocialPreview( | ||
| "Short opening sentence. This second sentence is intentionally long enough to cross the one hundred and forty character threshold before it reaches its final word in the sentence.", | ||
| ) | ||
|
|
||
| expect(result)->toBe("Short opening sentence.") | ||
| }, | ||
| ) | ||
|
|
||
| test("collapses line breaks and repeated spaces before evaluating the sentences", async () => { | ||
| let result = MetaDescription.shortenForSocialPreview( | ||
| "JavaScript Made Simple for Humans and AI.\n\nReScript is a strongly typed language that compiles to clean, efficient JavaScript that humans and AI tools can read and understand.", | ||
| ) | ||
|
|
||
| expect(result)->toBe( | ||
| "JavaScript Made Simple for Humans and AI. ReScript is a strongly typed language that compiles to clean, efficient JavaScript that humans and AI tools can read and understand.", | ||
| ) | ||
| }) | ||
|
|
||
| test("ignores empty sentence fragments created by repeated punctuation", async () => { | ||
| let result = MetaDescription.shortenForSocialPreview( | ||
| "First sentence... Second sentence stays short.", | ||
| ) | ||
|
|
||
| expect(result)->toBe("First sentence. Second sentence stays short.") | ||
| }) |
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
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,25 @@ | ||
| let maxSentenceLength = 140 | ||
|
|
||
| let collapseWhitespace = value => value->String.trim->String.replaceAllRegExp(/\s+/g, " ") | ||
|
|
||
| let ensurePeriod = sentence => | ||
| if sentence->String.endsWith(".") { | ||
| sentence | ||
| } else { | ||
| sentence ++ "." | ||
| } | ||
|
|
||
| let shortenForSocialPreview = description => { | ||
| let normalized = collapseWhitespace(description) | ||
| let sentences = | ||
| normalized->String.split(".")->Array.map(String.trim)->Array.filter(sentence => sentence != "") | ||
|
|
||
| switch (sentences->Array.get(0), sentences->Array.get(1)) { | ||
| | (Some(firstSentence), Some(secondSentence)) | ||
| if String.length(firstSentence) <= maxSentenceLength && | ||
| String.length(secondSentence) <= maxSentenceLength => | ||
| ensurePeriod(firstSentence) ++ " " ++ ensurePeriod(secondSentence) | ||
| | (Some(firstSentence), _) => ensurePeriod(firstSentence) | ||
| | _ => normalized | ||
| } | ||
| } |
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 |
|---|---|---|
|
|
@@ -2,15 +2,27 @@ module Intro = { | |
| @react.component | ||
| let make = () => { | ||
| <section className="flex justify-center"> | ||
| // We only need this font on the homepage, so we load it here instead of globally to save some bandwidth for users who navigate to other pages directly | ||
| <link | ||
| href="https://fonts.googleapis.com/css2?family=Red+Hat+Mono:wght@700&display=swap" | ||
| rel="stylesheet" | ||
| /> | ||
| <div className="max-w-1060 flex flex-col items-center px-5 sm:px-8 lg:box-content"> | ||
| <h1 className="hl-title text-center max-w-212"> | ||
| {React.string("Fast, Simple, Fully Typed JavaScript from the Future")} | ||
| {React.string("JavaScript Made Simple for Humans and AI")} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hope @ryyppy agrees with this one.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll wait until he can take a look at it before I merge it in. |
||
| </h1> | ||
| <h2 className="body-lg text-center text-gray-60 my-4 max-w-md"> | ||
| {React.string(`ReScript is a robustly typed language that compiles to efficient | ||
| and human-readable JavaScript. It comes with a lightning fast | ||
| compiler toolchain that scales to any codebase size.`)} | ||
| <h2 className="red-hat-mono-bold hl-1 text-center text-gray-60 my-4 max-w-md"> | ||
| {React.string(`Types > Vibes`)} | ||
| </h2> | ||
| <p className="body-lg text-center text-gray-60 mt-4 max-w-md"> | ||
| {React.string(`ReScript is a strongly typed language that compiles to clean, | ||
| efficient JavaScript that humans and AI tools can read and understand.`)} | ||
| </p> | ||
| <p className="body-lg text-center text-gray-60 my-4 max-w-md"> | ||
| {React.string(`Its fast compiler and static type system keep feedback loops tight, | ||
| so you can move quickly with AI assistance while maintaining | ||
| confidence as your codebase grows.`)} | ||
| </p> | ||
| <div className="mt-4 mb-2"> | ||
| <ReactRouter.Link to=#"/docs/manual/installation" prefetch=#viewport> | ||
| <Button> {React.string("Get started")} </Button> | ||
|
|
@@ -683,7 +695,11 @@ let make = (~components=MarkdownComponents.default) => { | |
| <> | ||
| <Meta | ||
| title="The ReScript Programming Language" | ||
| description="Fast, Simple, Fully Typed JavaScript from the Future" | ||
| description={`JavaScript Made Simple for Humans and AI. ReScript is a strongly typed language that compiles to clean, | ||
| efficient JavaScript that humans and AI tools can read and understand. | ||
| Its fast compiler and static type system keep feedback loops tight, | ||
| so you can move quickly with AI assistance while maintaining | ||
| confidence as your codebase grows.`} | ||
| keywords=["ReScript", "rescriptlang", "JavaScript", "JS", "TypeScript"] | ||
| /> | ||
| <div className="mt-4 xs:mt-16"> | ||
|
|
||
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
Oops, something went wrong.
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.
smart!