Skip to content
Merged
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: 2 additions & 0 deletions astro-site/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// @ts-check
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
import { remarkRewriteLinks } from './src/plugins/remark-rewrite-links.ts';

// https://astro.build/config
export default defineConfig({
site: 'https://braboj.github.io',
base: '/tutorial-git/',
trailingSlash: 'always',
integrations: [sitemap()],
markdown: {
syntaxHighlight: false,
remarkPlugins: [remarkRewriteLinks],
Expand Down
67 changes: 67 additions & 0 deletions astro-site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion astro-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/sitemap": "^3.7.2",
"astro": "^6.1.8"
}
}
}
4 changes: 4 additions & 0 deletions astro-site/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
User-agent: *
Allow: /

Sitemap: https://braboj.github.io/tutorial-git/sitemap-index.xml
1 change: 1 addition & 0 deletions astro-site/src/content.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const docs = defineCollection({
}),
schema: z.object({
title: z.string(),
description: z.string().optional(),
section: z.string(),
order: z.number(),
}),
Expand Down
32 changes: 29 additions & 3 deletions astro-site/src/layouts/DocLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,52 @@ import site from "../data/site.json";

interface Props {
title: string;
description?: string;
headings?: { depth: number; slug: string; text: string }[];
currentPath?: string;
jsonLd?: Record<string, unknown>;
}

const { title, headings = [], currentPath = "/" } = Astro.props;
const { title, description, headings = [], currentPath = "/", jsonLd } = Astro.props;
const pageDescription = description || site.description;
const pageTitle = `${title} — ${site.title}`;
const canonicalUrl = new URL(Astro.url.pathname, Astro.site);
const ogImage = new URL("/tutorial-git/images/og-banner.png", Astro.site);
---

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{title} — {site.title}</title>
<meta name="description" content={site.description} />
<title>{pageTitle}</title>
<meta name="description" content={pageDescription} />
<link rel="canonical" href={canonicalUrl} />

<!-- Open Graph -->
<meta property="og:type" content="article" />
<meta property="og:title" content={pageTitle} />
<meta property="og:description" content={pageDescription} />
<meta property="og:url" content={canonicalUrl} />
<meta property="og:image" content={ogImage} />
<meta property="og:site_name" content={site.title} />

<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={pageDescription} />
<meta name="twitter:image" content={ogImage} />

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;500&display=swap"
rel="stylesheet"
/>

{jsonLd && (
<script type="application/ld+json" set:html={JSON.stringify(jsonLd)} />
)}
</head>
<body>
<a href="#main-content" class="skip-link">Skip to main content</a>
Expand Down
29 changes: 28 additions & 1 deletion astro-site/src/pages/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,35 @@ export async function getStaticPaths() {
const { page, entry } = Astro.props;
const { Content, headings } = await render(entry);
const sectionPath = `/${page.section}/`;

const jsonLd = {
"@context": "https://schema.org",
"@type": "Article",
"headline": page.title,
"description": entry.data.description || "",
"author": {
"@type": "Person",
"name": "Branimir Georgiev",
"url": "https://github.com/braboj"
},
"publisher": {
"@type": "Person",
"name": "Branimir Georgiev"
},
"isPartOf": {
"@type": "Course",
"name": "Git Tutorial — Code with Branko",
"url": "https://braboj.github.io/tutorial-git/"
}
};
---

<DocLayout title={page.title} headings={headings} currentPath={sectionPath}>
<DocLayout
title={page.title}
description={entry.data.description}
headings={headings}
currentPath={sectionPath}
jsonLd={jsonLd}
>
<Content />
</DocLayout>
24 changes: 23 additions & 1 deletion astro-site/src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,31 @@ const headings = [
{ depth: 2, slug: "about", text: "About" },
{ depth: 2, slug: "selected-references", text: "Selected references" },
];

const jsonLd = {
"@context": "https://schema.org",
"@type": "Course",
"name": "Git Tutorial — Code with Branko",
"description": "A hands-on Git tutorial from first commit to confident daily use — concepts, exercises, and real-world examples.",
"url": "https://braboj.github.io/tutorial-git/",
"provider": {
"@type": "Person",
"name": "Branimir Georgiev",
"url": "https://github.com/braboj"
},
"educationalLevel": "Beginner to Advanced",
"inLanguage": "en",
"isAccessibleForFree": true
};
---

<DocLayout title="Let's Learn Git!" headings={headings} currentPath="/">
<DocLayout
title="Let's Learn Git!"
description="A hands-on Git tutorial from first commit to confident daily use — concepts, exercises, and real-world examples."
headings={headings}
currentPath="/"
jsonLd={jsonLd}
>

<p>
A hands-on tutorial that takes you from first commit to confident daily use.
Expand Down
1 change: 1 addition & 0 deletions chapters/01-introduction.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Introduction"
description: "What Git is, how to install it, how it works internally, and an overview of the most common commands."
section: "introduction"
order: 1
---
Expand Down
1 change: 1 addition & 0 deletions chapters/02-building-blocks.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Building Blocks"
description: "Git internals — repositories, the object model (blobs, trees, commits, tags), the staging area, references, and HEAD."
section: "building-blocks"
order: 2
---
Expand Down
1 change: 1 addition & 0 deletions chapters/03-branching-and-merging.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Branching and Merging"
description: "Create branches, merge and rebase changes, cherry-pick commits, resolve conflicts, and use the stash."
section: "branching-and-merging"
order: 3
---
Expand Down
1 change: 1 addition & 0 deletions chapters/04-remote-repositories.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Remote Repositories"
description: "Work with remote repositories — clone, fetch, pull, push, remote tracking branches, and forking workflows."
section: "remote-repositories"
order: 4
---
Expand Down
1 change: 1 addition & 0 deletions chapters/05-nested-repositories.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Nested Repositories"
description: "Include external repositories in your project using Git submodules and subtrees — trade-offs, workflows, and commands."
section: "nested-repositories"
order: 5
---
Expand Down
1 change: 1 addition & 0 deletions chapters/06-expert-topics.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Expert Topics"
description: "Power-user Git — configuration layers, revision selectors, pathspec, refspec, interactive rebase, bisect, hooks, and garbage collection."
section: "expert-topics"
order: 6
---
Expand Down
1 change: 1 addition & 0 deletions chapters/07-playbook.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Playbook"
description: "Step-by-step recipes for common Git tasks — undoing changes, branching, merging, rebasing, stashing, tagging, and debugging."
section: "playbook"
order: 7
---
Expand Down
1 change: 1 addition & 0 deletions chapters/08-appendix.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Appendix"
description: "Reference material — merge strategies, SSH key setup, Git clients, and external resources."
section: "appendix"
order: 8
---
Expand Down
1 change: 1 addition & 0 deletions chapters/09-glossary.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Glossary"
description: "Key Git terms and definitions — blob, branch, commit, HEAD, merge, rebase, remote, stash, tag, and more."
section: "glossary"
order: 9
---
Expand Down
Loading