Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(web): present correct metadata in head (#4764)
Elijah Potter4001b8b5d5ee
diff --git a/packages/web/src/app.d.ts b/packages/web/src/app.d.tsindex f59b884c5..91d79fadf 100644--- a/packages/web/src/app.d.ts+++ b/packages/web/src/app.d.ts@@ -1,3 +1,5 @@+/// <reference types="@sveltepress/vite/types" />+// See https://kit.svelte.dev/docs/types#app// for information about these interfacesdeclare global {diff --git a/packages/web/src/app.html b/packages/web/src/app.htmlindex 6e3aa8cb9..3ef90967c 100644--- a/packages/web/src/app.html+++ b/packages/web/src/app.html@@ -7,17 +7,10 @@<meta name="language" content="en" /><meta name="robots" content="index,follow" />- <title>Harper | Privacy-First Offline Grammar Checker for Developers & Writers</title>-- <meta name="description"- content="Harper is a blazing-fast, open-source grammar & spell checker that runs entirely on your device, covering US, UK, Canadian, Australian & Indian English—no data ever leaves your machine. Harper is the only grammar checker that doesn't use AI." />-<meta name="keywords"content="Harper, grammar checker, spell checker, privacy-first, offline, open source, fast grammar tool, developer writing, markdown checker" /><meta name="author" content="Elijah Potter" />- <link rel="canonical" href="https://writewithharper.com/" />-<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" /><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" /><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />@@ -29,15 +22,7 @@<meta property="og:type" content="website" /><meta property="og:site_name" content="Harper" /><meta property="og:locale" content="en_US" />- <meta property="og:url" content="https://writewithharper.com/" />- <meta property="og:title" content="Harper | Privacy-First Offline Grammar Checker" />- <meta property="og:description"- content="Harper checks your writing instantly—fast, lightweight and utterly private—so you can polish every clause without surrendering a single keystroke." />-<meta name="twitter:card" content="summary_large_image" />- <meta name="twitter:title" content="Harper | Privacy-First Offline Grammar Checker" />- <meta name="twitter:description"- content="Blazing-fast, open-source grammar & spell checking that never sends your words to the cloud." /><meta property="og:image" content="https://writewithharper.com/social_image.png" /><meta property="og:image:alt" content="Stylised ‘Harper’ wordmark on a clean pastel backdrop" /><meta property="og:image:type" content="image/png" />@@ -73,13 +58,6 @@}</script>- <title>Harper: Free, Open Source Grammar Checker</title>- <meta name="description" content="Harper checks your writing fast, without compromising your privacy." />- <link rel="canonical" href="https://writewithharper.com" />- <meta property="og:title" content="Harper: Free, Open Source Grammar Checker" />- <meta property="og:description" content="Harper checks your writing fast, without compromising your privacy." />- <meta property="og:url" content="https://writewithharper.com" />-<script>(() => {var stored = localStorage.getItem('SVELTEPRESS_DARK_MODE') || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'on' : 'off');diff --git a/packages/web/src/lib/PageMetadata.svelte b/packages/web/src/lib/PageMetadata.sveltenew file mode 100644index 000000000..f61e7fda3--- /dev/null+++ b/packages/web/src/lib/PageMetadata.svelte@@ -0,0 +1,23 @@+<script lang="ts">+import type { ResolvedPageMetadata } from './seo';++/** SveltePress owns document titles/descriptions on docs pages; this component owns the other tags. */+interface Props extends ResolvedPageMetadata {+ includeDocumentMetadata?: boolean;+}++let { title, description, canonical, includeDocumentMetadata = true }: Props = $props();+</script>++<svelte:head>+ {#if includeDocumentMetadata}+ <title>{title}</title>+ <meta name="description" content={description} />+ {/if}+ <link rel="canonical" href={canonical} />+ <meta property="og:url" content={canonical} />+ <meta property="og:title" content={title} />+ <meta property="og:description" content={description} />+ <meta name="twitter:title" content={title} />+ <meta name="twitter:description" content={description} />+</svelte:head>diff --git a/packages/web/src/lib/marketing/SveltePressPageLayout.svelte b/packages/web/src/lib/marketing/SveltePressPageLayout.svelteindex 9db27e52d..cd23e2816 100644--- a/packages/web/src/lib/marketing/SveltePressPageLayout.svelte+++ b/packages/web/src/lib/marketing/SveltePressPageLayout.svelte@@ -1,6 +1,9 @@<script>+import siteConfig from 'virtual:sveltepress/site';import DefaultPageLayout from '@sveltepress/theme-default/PageLayout.svelte';import { page } from '$app/stores';+import PageMetadata from '$lib/PageMetadata.svelte';+import { resolvePageMetadata } from '$lib/seo';const { fm, children, heroImage, titleAction, ...rest } = $props();@@ -8,8 +11,13 @@ const marketingRoutes = new Set(['/', '/get', '/desktop', '/install-browser-exteconst isMarketingRoute = $derived(marketingRoutes.has($page.url.pathname.replace(/\/$/, '') || '/'),);+const metadata = $derived(+ resolvePageMetadata($page.url.pathname, fm, siteConfig, isMarketingRoute),+);</script>+<PageMetadata {...metadata} includeDocumentMetadata={isMarketingRoute} />+{#if isMarketingRoute}{@render children?.()}{:else}diff --git a/packages/web/src/lib/seo.ts b/packages/web/src/lib/seo.tsnew file mode 100644index 000000000..f031847a1--- /dev/null+++ b/packages/web/src/lib/seo.ts@@ -0,0 +1,39 @@+const siteOrigin = 'https://writewithharper.com';++/** Page frontmatter fields used for document and social metadata. */+export interface MetadataInput {+ title?: string;+ description?: string;+}++/** Final metadata shared by the page head and SveltePress layout. */+export interface ResolvedPageMetadata {+ title: string;+ description: string;+ canonical: string;+}++/** Use the production origin and a slash-normalized path, without query or fragment data. */+export function canonicalUrl(pathname: string): string {+ const url = new URL(siteOrigin);+ url.pathname = pathname.split(/[?#]/)[0].replace(/\/+$/, '') || '/';+ return url.href;+}++/** Match SveltePress title/description defaults; marketing pages use their titles without a suffix. */+export function resolvePageMetadata(+ pathname: string,+ frontmatter: MetadataInput,+ site: Required<MetadataInput>,+ standaloneTitle = false,+): ResolvedPageMetadata {+ return {+ title: frontmatter.title+ ? standaloneTitle+ ? frontmatter.title+ : `${frontmatter.title} - ${site.title}`+ : site.title,+ description: frontmatter.description || site.description,+ canonical: canonicalUrl(pathname),+ };+}diff --git a/packages/web/src/routes/+page.svelte b/packages/web/src/routes/+page.svelteindex af9159e5d..04867e823 100644--- a/packages/web/src/routes/+page.svelte+++ b/packages/web/src/routes/+page.svelte@@ -1,6 +1,8 @@-<script module>+<script module lang="ts">export const frontmatter = {home: false,+ title: 'Free Grammar & Spell Checker — Private, No AI',+ description: 'Harper is the free, private, open-source grammar checker that runs on your device.',};</script>@@ -160,14 +162,6 @@ onMount(() => {</script>-<svelte:head>- <title>Free Grammar & Spell Checker — Private, No AI</title>- <meta- name="description"- content="Harper is the free, private, open-source grammar checker that runs on your device."- />-</svelte:head>-<div class="min-h-screen bg-[#f6f1e6] text-[#1c1a16] dark:bg-black dark:text-white"><MarketingHeader active="home" />diff --git a/packages/web/src/routes/desktop/+page.svelte b/packages/web/src/routes/desktop/+page.svelteindex 1bd7ac3b8..c85723eb4 100644--- a/packages/web/src/routes/desktop/+page.svelte+++ b/packages/web/src/routes/desktop/+page.svelte@@ -1,3 +1,10 @@+<script module lang="ts">+export const frontmatter = {+ title: 'Harper Desktop',+ description: 'Harper Desktop brings private grammar checking to text fields across macOS.',+};+</script>+<script lang="ts">import AppLogoTile from '$lib/marketing/AppLogoTile.svelte';import DesktopMockups from '$lib/marketing/DesktopMockups.svelte';@@ -29,14 +36,6 @@ const faqs = [];</script>-<svelte:head>- <title>Harper Desktop</title>- <meta- name="description"- content="Harper Desktop brings private grammar checking to text fields across macOS."- />-</svelte:head>-<div class="min-h-screen bg-[#f6efe2] text-[#1c1a16] dark:bg-black dark:text-white"><MarketingHeader active="desktop" />diff --git a/packages/web/src/routes/docs/about/+page.md b/packages/web/src/routes/docs/about/+page.mdindex 447dbe272..3bd6cd226 100644--- a/packages/web/src/routes/docs/about/+page.md+++ b/packages/web/src/routes/docs/about/+page.md@@ -1,33 +1,37 @@---title: What Is Harper?+description: Learn how Harper checks English grammar, how releases are versioned, and which projects use Harper.---Harper is a grammar checker designed to run anywhere there is text (so really, anywhere).Most Harper users are catching their mistakes in [Neovim](./integrations/neovim), [Obsidian](./integrations/obsidian), or [Visual Studio Code](./integrations/visual-studio-code).<script>- import { Editor } from "harper-editor"import { onMount } from "svelte"+ import { createEditorLinter } from "$lib/createEditorLinter"let linter = null+ let Editor = nullonMount(async () => {- const [{ WorkerLinter }, { slimBinary }] = await Promise.all([- import("harper.js"),- import("harper.js/slimBinary"),+ const [editorModule, instance] = await Promise.all([+ import("harper-editor"),+ createEditorLinter(),])- linter = new WorkerLinter({ binary: slimBinary })- await linter.setup()+ Editor = editorModule.Editor+ linter = instance})</script><div class="h-96">- {#if linter}- <Editor+ {#if Editor && linter}+ <svelte:component this={Editor}content={`You can try out a editor that uses\nHarper under the hood here.\n\nIt is rnning in your browser right now. \n\nNo server required!`}{linter}/>+ {:else}+ <p role="status">Loading Harper's grammar engine...</p>{/if}</div>diff --git a/packages/web/src/routes/docs/about/+page.ts b/packages/web/src/routes/docs/about/+page.tsdeleted file mode 100644index a3d15781a..000000000--- a/packages/web/src/routes/docs/about/+page.ts+++ /dev/null@@ -1 +0,0 @@-export const ssr = false;diff --git a/packages/web/src/routes/docs/contributors/architecture/+page.md b/packages/web/src/routes/docs/contributors/architecture/+page.mdindex b477d7882..d458bd388 100644--- a/packages/web/src/routes/docs/contributors/architecture/+page.md+++ b/packages/web/src/routes/docs/contributors/architecture/+page.md@@ -1,5 +1,6 @@---title: Harper's Architecture+description: Explore the Harper architecture and find the components that parse text, check grammar, and support integrations.---This document seeks to solve one simple problem:diff --git a/packages/web/src/routes/docs/contributors/author-a-rule/+page.md b/packages/web/src/routes/docs/contributors/author-a-rule/+page.mdindex 1bf764177..d196677f4 100644--- a/packages/web/src/routes/docs/contributors/author-a-rule/+page.md+++ b/packages/web/src/routes/docs/contributors/author-a-rule/+page.md@@ -1,5 +1,6 @@---title: Author a Rule+description: Follow the contributor guide to implement a Harper grammar rule and test its suggestions.---[Harper's grammatical rules are many](../rules), but most are relatively easy to understand.diff --git a/packages/web/src/routes/docs/contributors/brill/+page.md b/packages/web/src/routes/docs/contributors/brill/+page.mdindex 262c2dbc1..78161a6db 100644--- a/packages/web/src/routes/docs/contributors/brill/+page.md+++ b/packages/web/src/routes/docs/contributors/brill/+page.md@@ -1,5 +1,6 @@---title: Brill Tagging+description: Learn how Harper uses Brill tagging to refine dictionary-based part-of-speech analysis.---Harper uses Brill tagging as a refinement step to a dictionary-based [POS tagging](https://en.wikipedia.org/wiki/Part-of-speech_tagging) approach.diff --git a/packages/web/src/routes/docs/contributors/chrome-extension/+page.md b/packages/web/src/routes/docs/contributors/chrome-extension/+page.mdindex 133d9ea6b..88c7b628a 100644--- a/packages/web/src/routes/docs/contributors/chrome-extension/+page.md+++ b/packages/web/src/routes/docs/contributors/chrome-extension/+page.md@@ -1,5 +1,6 @@---title: Chrome Extension+description: Explore the Harper browser extension architecture, including its content script, options page, and popup.---Harper's Chrome extension is still in its infancy.diff --git a/packages/web/src/routes/docs/contributors/committer/+page.md b/packages/web/src/routes/docs/contributors/committer/+page.mdindex 8347564af..50e9e0f3b 100644--- a/packages/web/src/routes/docs/contributors/committer/+page.md+++ b/packages/web/src/routes/docs/contributors/committer/+page.md@@ -1,5 +1,6 @@----title: What is a Harper Committer+title: What is a Harper Committer+description: Learn about Harper committer responsibilities, patch reviews, and permissions in the project community.---As Harper continues to grow, it’s important to build a team of people capable of making changes within the project. This shares responsibility and avoids bottlenecking progress on a single person. For this purpose, the project has Harper Committers, who are entrusted with elevated privileges within the project and community.diff --git a/packages/web/src/routes/docs/contributors/committing/+page.md b/packages/web/src/routes/docs/contributors/committing/+page.mdindex ff3c5251c..a00ec14b8 100644--- a/packages/web/src/routes/docs/contributors/committing/+page.md+++ b/packages/web/src/routes/docs/contributors/committing/+page.md@@ -1,5 +1,6 @@---title: Committing+description: Prepare Harper contributions with conventional commits, formatting checks, and the required review process.---Harper follows [conventional commit practices](https://www.conventionalcommits.org/en/v1.0.0/).diff --git a/packages/web/src/routes/docs/contributors/desktop/+page.md b/packages/web/src/routes/docs/contributors/desktop/+page.mdindex 315a00ab4..e9ab62016 100644--- a/packages/web/src/routes/docs/contributors/desktop/+page.md+++ b/packages/web/src/routes/docs/contributors/desktop/+page.md@@ -1,5 +1,6 @@---title: Harper Desktop+description: Explore the Harper Desktop code structure, its processes, and the separation of platform-specific behavior.---Harper Desktop supports macOS and Windows, and we hope to add Linux support in the future.diff --git a/packages/web/src/routes/docs/contributors/dictionary/+page.md b/packages/web/src/routes/docs/contributors/dictionary/+page.mdindex 00ca1eb32..78e786127 100644--- a/packages/web/src/routes/docs/contributors/dictionary/+page.md+++ b/packages/web/src/routes/docs/contributors/dictionary/+page.md@@ -1,5 +1,6 @@---title: Updating the Curated Dictionary+description: Add words and annotations to the Harper curated English dictionary and validate dictionary changes.---The curated dictionary is the English dictionary Harper uses as reference internally when analyzing or modifying English text.diff --git a/packages/web/src/routes/docs/contributors/environment/+page.md b/packages/web/src/routes/docs/contributors/environment/+page.mdindex 58752d857..9258ec535 100644--- a/packages/web/src/routes/docs/contributors/environment/+page.md+++ b/packages/web/src/routes/docs/contributors/environment/+page.md@@ -1,5 +1,6 @@---title: Set Up Your Environment+description: Set up the Rust, Node.js, and optional Nix tools needed to build and develop Harper components.---Depending on what you're wanting to work on within the Harper repo, you may not need to set up every aspect of the environment described on this page.diff --git a/packages/web/src/routes/docs/contributors/faq/+page.md b/packages/web/src/routes/docs/contributors/faq/+page.mdindex e1ec2f3fa..5d92d9d16 100644--- a/packages/web/src/routes/docs/contributors/faq/+page.md+++ b/packages/web/src/routes/docs/contributors/faq/+page.md@@ -1,5 +1,6 @@---title: Frequently Asked Questions+description: Find answers to Harper contributor questions, including the difference between Linter and PatternLinter.---This page will be composed of frequently asked questions for contributors.diff --git a/packages/web/src/routes/docs/contributors/introduction/+page.md b/packages/web/src/routes/docs/contributors/introduction/+page.mdindex d322998ed..ebd52535f 100644--- a/packages/web/src/routes/docs/contributors/introduction/+page.md+++ b/packages/web/src/routes/docs/contributors/introduction/+page.md@@ -1,5 +1,6 @@---title: Introduction to Contributing+description: Start contributing to Harper with links to environment setup, contribution guidelines, and project support.---Harper is completely open to outside contributions of any kind.diff --git a/packages/web/src/routes/docs/contributors/local-stats/+page.md b/packages/web/src/routes/docs/contributors/local-stats/+page.mdindex 3b80f4364..3c4c8f3b2 100644--- a/packages/web/src/routes/docs/contributors/local-stats/+page.md+++ b/packages/web/src/routes/docs/contributors/local-stats/+page.md@@ -1,5 +1,6 @@---title: Local Statistics+description: Understand Harper local writing statistics, their storage, and the stats.txt format used by integrations.---Harper keeps track of certain aspects of your writing.diff --git a/packages/web/src/routes/docs/contributors/obsidian/+page.md b/packages/web/src/routes/docs/contributors/obsidian/+page.mdindex bb2b30324..35d43495d 100644--- a/packages/web/src/routes/docs/contributors/obsidian/+page.md+++ b/packages/web/src/routes/docs/contributors/obsidian/+page.md@@ -1,5 +1,6 @@---title: Contributor's Guide to the Obsidian Plugin+description: Build and develop the Harper Obsidian plugin and learn about its packaging and development constraints.---This page will outline the most important bits of information needed to work on the Harper Obsidian plugin.diff --git a/packages/web/src/routes/docs/contributors/review/+page.md b/packages/web/src/routes/docs/contributors/review/+page.mdindex c11ce20f0..1b6af2ec3 100644--- a/packages/web/src/routes/docs/contributors/review/+page.md+++ b/packages/web/src/routes/docs/contributors/review/+page.md@@ -1,5 +1,6 @@---title: Reviewing Pull Requests+description: Download Harper build artifacts and test proposed changes locally when reviewing pull requests.---There are a lot of individual components and artifacts that make up Harper.diff --git a/packages/web/src/routes/docs/contributors/testing-strategy/+page.md b/packages/web/src/routes/docs/contributors/testing-strategy/+page.mdindex a85bad775..7bab396f4 100644--- a/packages/web/src/routes/docs/contributors/testing-strategy/+page.md+++ b/packages/web/src/routes/docs/contributors/testing-strategy/+page.md@@ -1,5 +1,6 @@---title: Harper's Testing Strategy+description: Understand the Harper testing strategy, software quality goals, and role of automated checks and production feedback.---Harper is a complex project. We deliver many artifacts to many users, and the automated processes we use to do so can seem intimidating.diff --git a/packages/web/src/routes/docs/contributors/visual-studio-code/+page.md b/packages/web/src/routes/docs/contributors/visual-studio-code/+page.mdindex 323f13671..49afad787 100644--- a/packages/web/src/routes/docs/contributors/visual-studio-code/+page.md+++ b/packages/web/src/routes/docs/contributors/visual-studio-code/+page.md@@ -1,5 +1,6 @@---title: Visual Studio Code+description: Run, debug, test, and package the Harper Visual Studio Code extension in a local development environment.---This document details how to develop the Visual Studio Code extension locally. If you're interested in how it's packaged and distributed, you can check out the [Release VS Code Plugin](https://github.com/Automattic/harper/blob/master/.github/workflows/release_vscode_plugin.yml) workflow.diff --git a/packages/web/src/routes/docs/contributors/website/+page.md b/packages/web/src/routes/docs/contributors/website/+page.mdindex 0c2d6ac5d..243434245 100644--- a/packages/web/src/routes/docs/contributors/website/+page.md+++ b/packages/web/src/routes/docs/contributors/website/+page.md@@ -1,5 +1,6 @@---title: Website+description: Develop the Harper website locally with SvelteKit and SveltePress, and find its source files and build commands.---This page describes how to develop [writewithharper.com](https://writewithharper.com) locally.diff --git a/packages/web/src/routes/docs/contributors/wordpress/+page.md b/packages/web/src/routes/docs/contributors/wordpress/+page.mdindex 4d9e5a61a..154c49e0a 100644--- a/packages/web/src/routes/docs/contributors/wordpress/+page.md+++ b/packages/web/src/routes/docs/contributors/wordpress/+page.md@@ -1,5 +1,6 @@---title: WordPress Plugin+description: Build and develop the legacy Harper WordPress plugin locally with the repository development tools.---This page will describe most of what you need to know to build and develop the WordPress plugin locally.diff --git a/packages/web/src/routes/docs/harperjs/CDN/+page.md b/packages/web/src/routes/docs/harperjs/CDN/+page.mdindex 76e604f2d..0d701d433 100644--- a/packages/web/src/routes/docs/harperjs/CDN/+page.md+++ b/packages/web/src/routes/docs/harperjs/CDN/+page.md@@ -1,5 +1,6 @@---title: Using a CDN+description: Load harper.js from a CDN with native browser modules and explore a complete HTML example.---You can consume Harper from the [unpkg](https://unpkg.com/) CDN using native ECMAScript module syntax which is supported by all modern browsers.diff --git a/packages/web/src/routes/docs/harperjs/configurerules/+page.md b/packages/web/src/routes/docs/harperjs/configurerules/+page.mdindex 8c029e7de..be68eb435 100644--- a/packages/web/src/routes/docs/harperjs/configurerules/+page.md+++ b/packages/web/src/routes/docs/harperjs/configurerules/+page.md@@ -1,5 +1,6 @@---title: Configure Rules+description: Read and update harper.js lint configuration to enable, disable, or reset individual grammar rules.---We add new [rules](/docs/rules) to Harper on a daily basis.diff --git a/packages/web/src/routes/docs/harperjs/introduction/+page.md b/packages/web/src/routes/docs/harperjs/introduction/+page.mdindex 9a8cda5c3..7f6e96d6e 100644--- a/packages/web/src/routes/docs/harperjs/introduction/+page.md+++ b/packages/web/src/routes/docs/harperjs/introduction/+page.md@@ -1,5 +1,6 @@---title: Introduction to harper.js+description: Install harper.js and add Harper grammar checking to JavaScript and TypeScript applications.---## The Missiondiff --git a/packages/web/src/routes/docs/harperjs/linting/+page.md b/packages/web/src/routes/docs/harperjs/linting/+page.mdindex 88711f22c..36bfb5da0 100644--- a/packages/web/src/routes/docs/harperjs/linting/+page.md+++ b/packages/web/src/routes/docs/harperjs/linting/+page.md@@ -1,5 +1,6 @@---title: Linting With harper.js+description: Check text with harper.js and learn when to use LocalLinter or WorkerLinter.---[Linting](<https://en.wikipedia.org/wiki/Lint_(software)>) is the process of consuming, analyzing, and finding faults in text.diff --git a/packages/web/src/routes/docs/harperjs/node/+page.md b/packages/web/src/routes/docs/harperjs/node/+page.mdindex ef9ca2de5..a43d2f929 100644--- a/packages/web/src/routes/docs/harperjs/node/+page.md+++ b/packages/web/src/routes/docs/harperjs/node/+page.md@@ -1,5 +1,6 @@---title: Using Harper in Node.js+description: Run harper.js in Node.js with LocalLinter and the provided example code.---Harper.js can run in Node.js.diff --git a/packages/web/src/routes/docs/harperjs/spans/+page.md b/packages/web/src/routes/docs/harperjs/spans/+page.mdindex 994caeab1..70c5e0190 100644--- a/packages/web/src/routes/docs/harperjs/spans/+page.md+++ b/packages/web/src/routes/docs/harperjs/spans/+page.md@@ -1,5 +1,6 @@---title: Spans+description: Use harper.js lint spans to locate grammar suggestions and map their start and end positions to source text.---When you lint a document using `harper.js`, you'll get back a series of `Lint` objects, each with a `span` method available.diff --git a/packages/web/src/routes/docs/integrations/chrome-extension/+page.md b/packages/web/src/routes/docs/integrations/chrome-extension/+page.mdindex 7e3091ef0..26a656e60 100644--- a/packages/web/src/routes/docs/integrations/chrome-extension/+page.md+++ b/packages/web/src/routes/docs/integrations/chrome-extension/+page.md@@ -1,5 +1,6 @@---title: The Harper Chrome Extension+description: Install the Harper Chrome extension to check English grammar in emails, messages, and documents.---Harper is free to use for the > 3.6 billion people out there using Chrome.diff --git a/packages/web/src/routes/docs/integrations/emacs/+page.md b/packages/web/src/routes/docs/integrations/emacs/+page.mdindex b94d25ec5..af1186fcd 100644--- a/packages/web/src/routes/docs/integrations/emacs/+page.md+++ b/packages/web/src/routes/docs/integrations/emacs/+page.md@@ -1,5 +1,6 @@---title: Emacs+description: Configure Emacs and Eglot to use the Harper language server for English grammar checking.---Our Emacs integration is powered by [`harper-ls`](./language-server).diff --git a/packages/web/src/routes/docs/integrations/firefox-extension/+page.md b/packages/web/src/routes/docs/integrations/firefox-extension/+page.mdindex 8baed7a7b..54de7c78b 100644--- a/packages/web/src/routes/docs/integrations/firefox-extension/+page.md+++ b/packages/web/src/routes/docs/integrations/firefox-extension/+page.md@@ -1,5 +1,6 @@---title: The Harper Firefox Extension+description: Install the Harper Firefox extension for local English grammar checking in the browser.---Harper is available for the millions who rely on Firefox for fast, private, and independent browsing.diff --git a/packages/web/src/routes/docs/integrations/helix/+page.md b/packages/web/src/routes/docs/integrations/helix/+page.mdindex 0db03c11e..b550a43f1 100644--- a/packages/web/src/routes/docs/integrations/helix/+page.md+++ b/packages/web/src/routes/docs/integrations/helix/+page.md@@ -1,5 +1,6 @@---title: Helix+description: Connect Helix to harper-ls and configure English grammar diagnostics and rule settings.---Our Helix integration is powered by [`harper-ls`](./language-server).diff --git a/packages/web/src/routes/docs/integrations/language-server/+page.md b/packages/web/src/routes/docs/integrations/language-server/+page.mdindex 7ceb4b9b5..05f0cbcd2 100644--- a/packages/web/src/routes/docs/integrations/language-server/+page.md+++ b/packages/web/src/routes/docs/integrations/language-server/+page.md@@ -1,5 +1,6 @@---title: Language Server+description: Install and configure harper-ls, including dictionaries, grammar rules, and editor integrations.---`harper-ls` is the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) frontend for Harper.diff --git a/packages/web/src/routes/docs/integrations/neovim/+page.md b/packages/web/src/routes/docs/integrations/neovim/+page.mdindex 52d8cfb29..844207d4f 100644--- a/packages/web/src/routes/docs/integrations/neovim/+page.md+++ b/packages/web/src/routes/docs/integrations/neovim/+page.md@@ -1,5 +1,6 @@---title: Neovim+description: Set up harper-ls in Neovim with nvim-lspconfig and customize grammar checking options.---Our Neovim integration is powered by [`harper-ls`](./language-server).diff --git a/packages/web/src/routes/docs/integrations/obsidian/+page.md b/packages/web/src/routes/docs/integrations/obsidian/+page.mdindex c8297c473..e142c3246 100644--- a/packages/web/src/routes/docs/integrations/obsidian/+page.md+++ b/packages/web/src/routes/docs/integrations/obsidian/+page.md@@ -1,5 +1,6 @@---title: Harper for Obsidian+description: Install Harper in Obsidian to check English notes and learn about plugin setup and support.---Put simply, [Harper](https://writewithharper.com/) is a grammar checking plugin that doesn't violate your privacy.diff --git a/packages/web/src/routes/docs/integrations/sublime-text/+page.md b/packages/web/src/routes/docs/integrations/sublime-text/+page.mdindex b62a2819f..8afb77825 100644--- a/packages/web/src/routes/docs/integrations/sublime-text/+page.md+++ b/packages/web/src/routes/docs/integrations/sublime-text/+page.md@@ -1,5 +1,6 @@---title: Sublime Text+description: Set up the Harper language server in Sublime Text with LSP and customize its grammar checking configuration.---Our [Sublime Text](https://www.sublimetext.com/) integration is powered by [`harper-ls`](./language-server).diff --git a/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md b/packages/web/src/routes/docs/integrations/visual-studio-code/+page.mdindex 9b72161a7..9ceee666c 100644--- a/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md+++ b/packages/web/src/routes/docs/integrations/visual-studio-code/+page.md@@ -1,5 +1,6 @@---title: Visual Studio Code+description: Install the Harper Visual Studio Code extension and configure grammar checking through its language server settings.---For our Visual Studio Code integration, we provide an extension powered by [`harper-ls`](./language-server), which also works for VS Code forks like VSCodium and Windsurf. It's available in the [Visual Studio Marketplace](https://marketplace.visualstudio.com/items?itemName=elijah-potter.harper) as well as the [Open VSX Registry](https://open-vsx.org/extension/elijah-potter/harper).diff --git a/packages/web/src/routes/docs/integrations/wordpress/+page.md b/packages/web/src/routes/docs/integrations/wordpress/+page.mdindex ba0a847fc..3163f88fd 100644--- a/packages/web/src/routes/docs/integrations/wordpress/+page.md+++ b/packages/web/src/routes/docs/integrations/wordpress/+page.md@@ -1,5 +1,6 @@---title: Harper for WordPress+description: Use the recommended Harper Chrome extension in WordPress and review the legacy plugin options.---<script>diff --git a/packages/web/src/routes/docs/integrations/zed/+page.md b/packages/web/src/routes/docs/integrations/zed/+page.mdindex ba3db26ad..519f302ea 100644--- a/packages/web/src/routes/docs/integrations/zed/+page.md+++ b/packages/web/src/routes/docs/integrations/zed/+page.md@@ -1,5 +1,6 @@---title: Zed+description: Find the Harper extension for Zed and learn how it connects the editor to harper-ls.---For our Zed integration, we have an [extension](https://github.com/zed-extensions/harper) that automatically downloads and runs [`harper-ls`](./language-server). For more information on how to install it and how it works, you can head over to the [extension's README](https://github.com/zed-extensions/harper/blob/main/README.md).diff --git a/packages/web/src/routes/docs/rules/+page.server.ts b/packages/web/src/routes/docs/rules/+page.server.tsnew file mode 100644index 000000000..c095e3c2c--- /dev/null+++ b/packages/web/src/routes/docs/rules/+page.server.ts@@ -0,0 +1,17 @@+import { LocalLinter } from 'harper.js';+import { slimBinaryInlined } from 'harper.js/slimBinaryInlined';+import type { PageServerLoad } from './$types';++export const load: PageServerLoad = async () => {+ // Keep the WASM in the server bundle instead of requiring an adjacent binary file.+ const linter = new LocalLinter({ binary: slimBinaryInlined });+ try {+ const [descriptions, defaultConfig] = await Promise.all([+ linter.getLintDescriptionsHTML(),+ linter.getDefaultLintConfig(),+ ]);+ return { descriptions, defaultConfig };+ } finally {+ await linter.dispose();+ }+};diff --git a/packages/web/src/routes/docs/rules/+page.svelte b/packages/web/src/routes/docs/rules/+page.svelteindex 23b935833..1d870b0d9 100644--- a/packages/web/src/routes/docs/rules/+page.svelte+++ b/packages/web/src/routes/docs/rules/+page.svelte@@ -1,4 +1,12 @@<script module lang="ts">+export const frontmatter = {+ title: 'Rules',+ description:+ 'Browse Harper grammar rules, their descriptions, and whether each rule is enabled by default.',+};+</script>++<script lang="ts">import {Table,TableBody,@@ -7,23 +15,9 @@ import {TableHead,TableHeadCell,} from 'components';-import { type LintConfig, LocalLinter } from 'harper.js';-import { slimBinary } from 'harper.js/slimBinary';--export const frontmatter = {- title: 'Rules',-};--let descriptions: Record<string, string> = $state({});-let default_config: LintConfig = $state({});+import type { PageData } from './$types';-let linter = new LocalLinter({ binary: slimBinary });-linter.getLintDescriptionsHTML().then(async (v) => {- descriptions = v;-});-linter.getDefaultLintConfig().then(async (v) => {- default_config = v;-});+let { data }: { data: PageData } = $props();</script><p>This page is an incomplete list of the various grammatical rules Harper checks for.</p>@@ -35,10 +29,10 @@ linter.getDefaultLintConfig().then(async (v) => {<TableHeadCell>Description</TableHeadCell></TableHead><TableBody>- {#each Object.entries(descriptions) as [name, description]}+ {#each Object.entries(data.descriptions) as [name, description]}<TableBodyRow><TableBodyCell>{name}</TableBodyCell>- <TableBodyCell>{default_config[name] ? '✔️' : '❌'}</TableBodyCell>+ <TableBodyCell>{data.defaultConfig[name] ? '✔️' : '❌'}</TableBodyCell><TableBodyCell tdClass="px-6 py-4 font-medium">{@html description.replaceAll('<p>', "").replaceAll('<p />', "")}</TableBodyCell></TableBodyRow>{/each}diff --git a/packages/web/src/routes/docs/weir/+page.md b/packages/web/src/routes/docs/weir/+page.mdindex 5ea26b442..7b3262479 100644--- a/packages/web/src/routes/docs/weir/+page.md+++ b/packages/web/src/routes/docs/weir/+page.md@@ -1,4 +1,7 @@-# The Weir Language+---+title: The Weir Language+description: Define custom Harper grammar rules with Weir expressions, replacements, tests, and Weirpacks.+---Most large organizations have a style guide.A document that decides which versions of a linguistic rule to use.diff --git a/packages/web/src/routes/editor/+page.svelte b/packages/web/src/routes/editor/+page.svelteindex 2d0646468..4fb2601b1 100644--- a/packages/web/src/routes/editor/+page.svelte+++ b/packages/web/src/routes/editor/+page.svelte@@ -1,25 +1,40 @@+<script module lang="ts">+export const frontmatter = {+ title: 'Harper Web Editor',+ description:+ 'Check English grammar and spelling in the Harper web editor and review suggested corrections.',+};+</script>+<script lang="ts">/// This page exists to be embedded via an `iframe`.import { Isolate } from 'components';import type { Linter } from 'harper.js';-import { Editor } from 'harper-editor';import { onMount } from 'svelte';import { page } from '$app/stores';import { createEditorLinter } from '$lib/createEditorLinter';let content = $page.url.searchParams.get('initialText') ?? '';let linter: Linter | null = null;+let Editor: typeof import('harper-editor').Editor | null = null;onMount(() => {- (async () => {- linter = await createEditorLinter();+ void (async () => {+ const [editorModule, instance] = await Promise.all([+ import('harper-editor'),+ createEditorLinter(),+ ]);+ Editor = editorModule.Editor;+ linter = instance;})();});</script><Isolate>- {#if linter}- <Editor {content} {linter}></Editor>+ {#if Editor && linter}+ <svelte:component this={Editor} {content} {linter} />+ {:else}+ <p role="status">Loading Harper's grammar engine...</p>{/if}</Isolate>diff --git a/packages/web/src/routes/editor/+page.ts b/packages/web/src/routes/editor/+page.tsdeleted file mode 100644index a3d15781a..000000000--- a/packages/web/src/routes/editor/+page.ts+++ /dev/null@@ -1 +0,0 @@-export const ssr = false;diff --git a/packages/web/src/routes/get/+page.svelte b/packages/web/src/routes/get/+page.svelteindex 11051e167..5442f2dff 100644--- a/packages/web/src/routes/get/+page.svelte+++ b/packages/web/src/routes/get/+page.svelte@@ -1,3 +1,10 @@+<script module lang="ts">+export const frontmatter = {+ title: 'Get Harper',+ description: 'Install Harper for desktop apps, browsers, code editors, and developer workflows.',+};+</script>+<script lang="ts">import { Arrow } from 'components';import { onMount } from 'svelte';@@ -62,14 +69,6 @@ function clearFilters() {}</script>-<svelte:head>- <title>Get Harper</title>- <meta- name="description"- content="Install Harper for desktop apps, browsers, code editors, and developer workflows."- />-</svelte:head>-<div class="min-h-screen bg-[#f6f1e6] text-[#1c1a16] dark:bg-black dark:text-white"><MarketingHeader active="get" />diff --git a/packages/web/src/routes/install-browser-extension/+page.svelte b/packages/web/src/routes/install-browser-extension/+page.svelteindex 861b10198..5436929be 100644--- a/packages/web/src/routes/install-browser-extension/+page.svelte+++ b/packages/web/src/routes/install-browser-extension/+page.svelte@@ -1,3 +1,11 @@+<script module lang="ts">+export const frontmatter = {+ title: 'Thanks for Installing Harper!',+ description:+ 'Learn how to check writing and review grammar suggestions with the Harper browser extension.',+};+</script>+<script lang="ts">import { ChevronRightIcon, Link, SlideDeck, Textarea } from 'components';import AppLogoTile from '$lib/marketing/AppLogoTile.svelte';@@ -41,10 +49,6 @@ let demoText ='Ths is an text box you can type in.\n\nany other site on the web will work the the same!';</script>-<svelte:head>- <title>Thanks for Installing Harper!</title>-</svelte:head>-<SlideDecktitle={steps[step].title}lede={steps[step].lede}diff --git a/packages/web/src/routes/weir/studio/+page.svelte b/packages/web/src/routes/weir/studio/+page.svelteindex a88ad6feb..84183ccf9 100644--- a/packages/web/src/routes/weir/studio/+page.svelte+++ b/packages/web/src/routes/weir/studio/+page.svelte@@ -1,3 +1,11 @@+<script module lang="ts">+export const frontmatter = {+ title: 'Weir Studio',+ description:+ 'Write and test custom Harper grammar rules in the browser, then package them as Weirpacks.',+};+</script>+<script lang="ts">import { Isolate } from 'components';import { packWeirpackFiles, unpackWeirpackBytes } from 'harper.js';