A repository's header says what it is on every page of it: its description, website and topics now show under its name on Code, its folders and files, Commits, Branches, Tags, Releases and Compare as they already did on Issues, Pull requests and the rest, where before the files' pages left them out for an About beside the files. That About no longer repeats them: the facts beside the files (readme, license, security policy, activity, stars, watching, then releases, packages, contributors and languages) stand without a title, description or link. The website is the project's homepage when it has one, else the repository's website, as the About chose it. Managing a repository describes the header and the facts beside the files. Checked: the site's typecheck (tsc -b --force), its 911 tests and a production build.
6 files+31−380/6 viewed
| 1 | 1 | --- | |
| 2 | 2 | title: Managing a repository | |
| 3 | − | description: What a repository's About shows, and how to rename it or a branch, change its default branch, website and topics, make it public or private, archive it, and delete and restore it. | |
| 3 | + | description: What a repository's header and Code page show, and how to rename it or a branch, change its default branch, website and topics, make it public or private, archive it, and delete and restore it. | |
| 4 | 4 | --- | |
| 5 | 5 | ||
| 6 | 6 | A repository's details and its lifecycle are managed from its | |
| ⋯ | |||
| 9 | 9 | server. This guide covers each change, who can make it, and what happens | |
| 10 | 10 | when you do. | |
| 11 | 11 | ||
| 12 | − | ## The About beside the files | |
| 12 | + | ## What it is, and the facts beside the files | |
| 13 | + | ||
| 14 | + | The header at the top of every page of a repository (Code, Issues, Pull | |
| 15 | + | requests, Actions, Settings and the rest) shows its description, website | |
| 16 | + | and topics, as you set them under [Edit the details](#edit-the-details). | |
| 17 | + | The website is the project's homepage when it has one. | |
| 13 | 18 | ||
| 14 | − | A repository's **Code** page shows its files with an **About** beside them, | |
| 15 | − | the way most code hosts lay it out. On a phone it comes after the files. | |
| 19 | + | The **Code** page shows its files with its facts beside them. On a phone | |
| 20 | + | they come after the files. | |
| 16 | 21 | ||
| 17 | 22 | | Part | What it shows | | |
| 18 | 23 | | --- | --- | | |
| 19 | − | | Description, website, topics | What you set under [Edit the details](#edit-the-details). | | |
| 20 | 24 | | **Readme** | A link to the README shown under the files. | | |
| 21 | 25 | | **License** | The license its `LICENSE` file holds, such as **MIT license**, linked to the file. **View license** when the text is not one g1t recognizes. `LICENCE`, `COPYING` and `UNLICENSE` are read too, with or without an extension, and an `SPDX-License-Identifier` line says it outright. | | |
| 22 | 26 | | **Security policy** | A link to `SECURITY.md` at the root, or in `.g1t`, `.github` or `docs`. | | |
| 1 | 1 | /** | |
| 2 | − | * The About beside a repository's files: what it is (description, home | |
| 3 | − | * page, topics), what its files say (readme, license, security policy), | |
| 4 | − | * how people follow it (activity, stars, watching), then its releases, | |
| 2 | + | * The facts beside a repository's files (what it is, its home page and | |
| 3 | + | * topics are the header's, on every page of it): what its files say | |
| 4 | + | * (readme, license, security policy), how people follow it (activity, | |
| 5 | + | * stars, watching), then its releases, | |
| 5 | 6 | * deployments, packages, contributors and languages, each a section. | |
| 6 | 7 | * | |
| 7 | 8 | * What is read from the default branch (license, languages, contributors) | |
| ⋯ | |||
| 13 | 14 | Activity, | |
| 14 | 15 | BookOpen, | |
| 15 | 16 | Eye, | |
| 16 | − | Link2, | |
| 17 | 17 | Package as PackageIcon, | |
| 18 | 18 | Plus, | |
| 19 | 19 | Scale, | |
| ⋯ | |||
| 31 | 31 | import { CommitAvatar, CommitName } from "./commit-person"; | |
| 32 | 32 | import { UserCard } from "./user-card"; | |
| 33 | 33 | import { PackageIcon as EcosystemIcon } from "./package-icon"; | |
| 34 | − | import { Topics } from "./topics"; | |
| 35 | 34 | import { TimeAgo } from "./ui"; | |
| 36 | 35 | import { Avatar } from "./ui/avatar"; | |
| 37 | 36 | import { Badge } from "./ui/badge"; | |
| ⋯ | |||
| 409 | 408 | readme, | |
| 410 | 409 | data, | |
| 411 | 410 | canPush, | |
| 412 | − | homepage, | |
| 413 | 411 | deployments = null, | |
| 414 | 412 | }: { | |
| 415 | 413 | repo: Repo; | |
| ⋯ | |||
| 417 | 415 | readme: boolean; | |
| 418 | 416 | data: AboutData; | |
| 419 | 417 | canPush: boolean; | |
| 420 | − | /** The project's homepage (lib/about.ts `projectHomepage`); the repository's website when null. */ | |
| 421 | − | homepage?: string | null; | |
| 422 | 418 | /** The Deployments section (deployments-panel.tsx): each environment's latest. */ | |
| 423 | 419 | deployments?: ReactNode; | |
| 424 | 420 | }) { | |
| 425 | 421 | const base = `/${repo.namespace}/${repo.name}`; | |
| 426 | − | const site = homepage ?? repo.website ?? null; | |
| 427 | 422 | const facts = (about: RepoAbout | null, watchers: number | null) => <Facts base={base} gitRef={gitRef} about={about} watchers={watchers} />; | |
| 428 | 423 | return ( | |
| 429 | 424 | <aside className="space-y-4"> | |
| 430 | 425 | <div> | |
| 431 | − | <h2 className="text-base font-semibold">About</h2> | |
| 432 | − | <p className="mt-2.5 text-sm text-fg-soft">{repo.description ?? (site || repo.topics.length > 0 ? "No description." : "No description, website, or topics provided.")}</p> | |
| 433 | − | {site && ( | |
| 434 | − | <a href={site} rel="noopener nofollow" className="mt-2.5 flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:underline"> | |
| 435 | − | <Link2 size={15} className="shrink-0" /> | |
| 436 | − | <span className="truncate">{site.replace(/^https?:\/\//, "").replace(/\/$/, "")}</span> | |
| 437 | − | </a> | |
| 438 | − | )} | |
| 439 | − | <Topics topics={repo.topics} className="mt-3" /> | |
| 440 | − | <ul className="mt-4 space-y-2.5 text-sm text-muted"> | |
| 426 | + | <ul className="space-y-2.5 text-sm text-muted"> | |
| 441 | 427 | {readme && ( | |
| 442 | 428 | <Row icon={<BookOpen size={15} />}> | |
| 443 | 429 | <a href="#readme" className={ROW_LINK}> | |
| 334 | 334 | checks = null, | |
| 335 | 335 | about = null, | |
| 336 | 336 | canPush = false, | |
| 337 | − | homepage = null, | |
| 338 | 337 | deployments = null, | |
| 339 | 338 | }: { | |
| 340 | 339 | tree: Tree; | |
| ⋯ | |||
| 347 | 346 | about?: AboutData | null; | |
| 348 | 347 | /** Whether the viewer may push, for the About's "Create a new release". */ | |
| 349 | 348 | canPush?: boolean; | |
| 350 | − | /** The project's homepage; the repository's website when null. */ | |
| 351 | − | homepage?: string | null; | |
| 352 | 349 | /** The repository's environments, for the About's Deployments section. */ | |
| 353 | 350 | deployments?: DeploymentEnvironments | null; | |
| 354 | 351 | }) { | |
| ⋯ | |||
| 424 | 421 | readme={Boolean(readme)} | |
| 425 | 422 | data={about ?? { about: null, watchers: null, packages: null, tags: null }} | |
| 426 | 423 | canPush={canPush} | |
| 427 | − | homepage={homepage} | |
| 428 | 424 | deployments={<DeploymentsPanel base={base} summary={deployments} className="border-t border-line pt-4" />} | |
| 429 | 425 | /> | |
| 430 | 426 | )} | |
| 8 | 8 | import { showOneCommit } from "../../lib/commit-people.server"; | |
| 9 | 9 | import { repos } from "../../lib/services.server"; | |
| 10 | 10 | import { getViewer, unwrap } from "../../lib/session.server"; | |
| 11 | − | import { projectHomepage } from "../../lib/about"; | |
| 12 | 11 | import { useProject } from "./layout"; | |
| 13 | 12 | import { repoPages } from "../../lib/repo-live"; | |
| 14 | 13 | import { useRepoLive } from "../../lib/use-repo-live"; | |
| ⋯ | |||
| 53 | 52 | checks={loaderData.checks} | |
| 54 | 53 | about={loaderData.about} | |
| 55 | 54 | canPush={Boolean(project?.access.can.push)} | |
| 56 | − | homepage={projectHomepage(project?.project ?? null)} | |
| 57 | 55 | deployments={loaderData.deployments} | |
| 58 | 56 | /> | |
| 59 | 57 | ); | |
| 1 | 1 | import { waitUntil } from "cloudflare:workers"; | |
| 2 | − | import { Box, Lock } from "lucide-react"; | |
| 2 | + | import { Box, Link2, Lock } from "lucide-react"; | |
| 3 | 3 | import type { ReactNode } from "react"; | |
| 4 | 4 | import { Link, Outlet, type ShouldRevalidateFunctionArgs, data, useLocation, useRouteLoaderData } from "react-router"; | |
| 5 | 5 | ||
| ⋯ | |||
| 7 | 7 | ||
| 8 | 8 | import type { Route } from "./+types/layout"; | |
| 9 | 9 | import { Topics } from "../../components/topics"; | |
| 10 | + | import { projectHomepage } from "../../lib/about"; | |
| 10 | 11 | import { page } from "../../lib/meta"; | |
| 11 | 12 | import { type Tab as PageTab, tabsFor } from "../../lib/project-nav"; | |
| 12 | 13 | import { Badge } from "../../components/ui/badge"; | |
| ⋯ | |||
| 170 | 171 | const base = `/${repo.namespace}/${repo.name}`; | |
| 171 | 172 | // The project's own description, else the repository's as it is now. | |
| 172 | 173 | const description = (project && !project.descriptionInherited ? project.description : null) ?? repo.description; | |
| 174 | + | // Its homepage, else the repository's website. | |
| 175 | + | const site = projectHomepage(project) ?? repo.website ?? null; | |
| 173 | 176 | const { pathname } = useLocation(); | |
| 174 | 177 | const rest = pathname.slice(base.length + 1); | |
| 175 | 178 | const tabs = tabsFor(rest, member, access.can); | |
| 176 | − | // The files' own About says what it is and its topics, as the one place. | |
| 177 | − | const filesPage = /^(code|tree|blob|commits?|branches|tags|releases|compare)(\/|$)/.test(rest); | |
| 178 | 179 | // One row of tabs for the project's pages, along the header's border (a | |
| 179 | 180 | // member's sidebar has them on a computer), and the views of the section | |
| 180 | 181 | // the page is in as a quieter row at the top of its content. | |
| ⋯ | |||
| 201 | 202 | ) : null | |
| 202 | 203 | } | |
| 203 | 204 | /> | |
| 204 | − | {/* On the files' pages, About says what it is and shows its topics, as the one place. */} | |
| 205 | − | {!filesPage && description && <p className="mt-2 line-clamp-2 max-w-3xl text-sm text-muted">{description}</p>} | |
| 206 | − | {!filesPage && <Topics topics={repo.topics} className="mt-3" />} | |
| 205 | + | {/* What it is, where it lives and its topics, the same on every page of it. */} | |
| 206 | + | {description && <p className="mt-2 line-clamp-2 max-w-3xl text-sm text-muted">{description}</p>} | |
| 207 | + | {site && ( | |
| 208 | + | <a | |
| 209 | + | href={site} | |
| 210 | + | rel="noopener nofollow" | |
| 211 | + | className="mt-1.5 flex w-fit max-w-full min-w-0 items-center gap-1.5 text-sm font-medium text-accent hover:underline" | |
| 212 | + | > | |
| 213 | + | <Link2 size={14} className="shrink-0" /> | |
| 214 | + | <span className="truncate">{site.replace(/^https?:\/\//, "").replace(/\/$/, "")}</span> | |
| 215 | + | </a> | |
| 216 | + | )} | |
| 217 | + | <Topics topics={repo.topics} className="mt-3" /> | |
| 207 | 218 | <div className={signedIn ? "mt-3 md:hidden" : "mt-3"}> | |
| 208 | 219 | <ProjectStrip base={base} member={member} can={access.can} settings={seesSettings(access)} counts={loaderData.open} always={!signedIn} /> | |
| 209 | 220 | </div> | |
| 9 | 9 | import { showOneCommit } from "../../lib/commit-people.server"; | |
| 10 | 10 | import { repos } from "../../lib/services.server"; | |
| 11 | 11 | import { getViewer, unwrap } from "../../lib/session.server"; | |
| 12 | − | import { projectHomepage } from "../../lib/about"; | |
| 13 | 12 | import { useProject } from "./layout"; | |
| 14 | 13 | import { repoPages } from "../../lib/repo-live"; | |
| 15 | 14 | import { useRepoLive } from "../../lib/use-repo-live"; | |
| ⋯ | |||
| 58 | 57 | checks={loaderData.checks} | |
| 59 | 58 | about={loaderData.about} | |
| 60 | 59 | canPush={Boolean(project?.access.can.push)} | |
| 61 | − | homepage={projectHomepage(project?.project ?? null)} | |
| 62 | 60 | deployments={loaderData.deployments} | |
| 63 | 61 | /> | |
| 64 | 62 | ); | |
Comments
Sign in to comment.