diff --git a/assets/css/book-print.css b/assets/css/book-print.css new file mode 100644 index 000000000..ef4bd738f --- /dev/null +++ b/assets/css/book-print.css @@ -0,0 +1,16 @@ +@media print { + body { + font-family: "Times New Roman", serif; + font-size: 12pt; + line-height: 1.6; + color: #000; + } + + header, footer, nav { + page-break-after: always; + } + + article { + page-break-before: always; + } +} diff --git a/assets/css/print.css b/assets/css/print.css new file mode 100644 index 000000000..a4dc804f0 --- /dev/null +++ b/assets/css/print.css @@ -0,0 +1,16 @@ +@media print { + body { + font-family: "Times New Roman", serif; + font-size: 12pt; + line-height: 1.6; + color: #000; + } + + header, footer, nav { + display: none; + } + + article { + page-break-after: always; + } +} diff --git a/layouts/_default/book.html b/layouts/_default/book.html new file mode 100644 index 000000000..590d6cfd6 --- /dev/null +++ b/layouts/_default/book.html @@ -0,0 +1,42 @@ +{{ define "main" }} + + + + + + {{ .Site.Title }} — Book + + + +
+

{{ .Site.Title }}

+

Printable Book — generated on {{ now.Format "January 2, 2006" }}

+
+
+ + + + {{ range $sorted }} +
+

{{ .Title }}

+ {{ .Content }} +
+ {{ end }} + + + + +{{ end }} + diff --git a/org-cyf-guides/assets/css/book-print.css b/org-cyf-guides/assets/css/book-print.css new file mode 100644 index 000000000..023b7de62 --- /dev/null +++ b/org-cyf-guides/assets/css/book-print.css @@ -0,0 +1,14 @@ +/* book-print.css - print-focused rules */ +@page { size: A4; margin: 20mm; } + +@media print { + body { font-family: Georgia, "Times New Roman", serif; font-size: 12pt; color: #000; background:#fff; margin: 0; } + header, .site-header, .site-footer, nav, .no-print { display: none !important; } + .toc { page-break-after: always; } + .chapter { page-break-before: always; } + h1, h2 { break-inside: avoid; page-break-after: avoid; } + p { orphans: 3; widows: 3; } + pre { white-space: pre-wrap; word-wrap: break-word; font-family: monospace; font-size: 10pt; } + img { max-width: 100%; height: auto; } + table { page-break-inside: avoid; border-collapse: collapse; } +} diff --git a/org-cyf-guides/config.toml b/org-cyf-guides/config.toml new file mode 100644 index 000000000..c371490b1 --- /dev/null +++ b/org-cyf-guides/config.toml @@ -0,0 +1,4 @@ +[[menu.main]] +name = "Book" +url = "/book/" +weight = 10 diff --git a/org-cyf-guides/content/book/_index.md b/org-cyf-guides/content/book/_index.md new file mode 100644 index 000000000..55b92604e --- /dev/null +++ b/org-cyf-guides/content/book/_index.md @@ -0,0 +1,5 @@ +--- +title: "Curriculum Book" +layout: "book" +--- +This page collects pages marked for the printed book. diff --git a/org-cyf-guides/content/book/chapter1.md b/org-cyf-guides/content/book/chapter1.md new file mode 100644 index 000000000..ee8e8e32e --- /dev/null +++ b/org-cyf-guides/content/book/chapter1.md @@ -0,0 +1,12 @@ +--- +title: "Chapter 1: Introduction" +book: true +book_order: 1 +--- + +Welcome to the printable **Book Layout** in Hugo! +This is your first chapter. You can add more chapters by running: + +```bash +hugo new book/chapter2.md + diff --git a/org-cyf-guides/content/book/chapter2.md b/org-cyf-guides/content/book/chapter2.md new file mode 100644 index 000000000..721cff973 --- /dev/null +++ b/org-cyf-guides/content/book/chapter2.md @@ -0,0 +1,8 @@ +--- +title: "Chapter 2: Advanced Topics" +book: true +book_order: 2 +--- + +This chapter expands on the concepts from Chapter 1 and explores more advanced topics. + diff --git a/org-cyf-guides/go.mod b/org-cyf-guides/go.mod index e6f2dd2d5..ebab863ee 100644 --- a/org-cyf-guides/go.mod +++ b/org-cyf-guides/go.mod @@ -3,8 +3,8 @@ module github.com/CodeYourFuture/curriculum/org-cyf-guides go 1.24.5 require ( - github.com/CodeYourFuture/curriculum/common-content v0.0.0-20241008095008-281a5517463f // indirect - github.com/CodeYourFuture/curriculum/common-theme v0.0.0-20241008095008-281a5517463f // indirect + github.com/CodeYourFuture/curriculum/common-content v0.0.0-20250801130816-705636729ea4 // indirect + github.com/CodeYourFuture/curriculum/common-theme v0.0.0-20250801130816-705636729ea4 // indirect github.com/CodeYourFuture/curriculum/org-cyf-theme v0.0.0-20240818070728-e8702788f7cb // indirect ) diff --git a/org-cyf-guides/layouts/_default/book.html b/org-cyf-guides/layouts/_default/book.html new file mode 100644 index 000000000..35dc4dd93 --- /dev/null +++ b/org-cyf-guides/layouts/_default/book.html @@ -0,0 +1,41 @@ +{{ define "main" }} + + + + + + {{ .Site.Title }} — Book + + + +
+

{{ .Site.Title }}

+

Printable Book — generated on {{ now.Format "January 2, 2006" }}

+
+
+ + + + {{ range $sorted }} +
+

{{ .Title }}

+ {{ .Content }} +
+ {{ end }} + + + + +{{ end }}