From: bochard Date: Sat, 21 Feb 2026 04:41:59 +0000 (+0800) Subject: refactored /part/head.php X-Git-Url: https://git.bochard.net/?a=commitdiff_plain;h=3fc1e056719d3ff8da906dd11b5ca2d78d7fa892;p=mysite.git refactored /part/head.php --- diff --git a/email.php b/email.php index c948736..c78aba2 100644 --- a/email.php +++ b/email.php @@ -1,11 +1,13 @@ "email", + "meta" => [ + ["name" => "description", "content" => "send me an email"] + ] +]); ?> +
diff --git a/guestbook.php b/guestbook.php index cbba13e..b3ec37e 100644 --- a/guestbook.php +++ b/guestbook.php @@ -1,11 +1,13 @@ "guestbook", + "meta" => [ + ["name" => "description", "content" => "sign my guestbook"] + ] +]); ?> +
diff --git a/how_to/index.php b/how_to/index.php index e2d6b03..2b66bc3 100644 --- a/how_to/index.php +++ b/how_to/index.php @@ -1,11 +1,10 @@ "tutorials" +]); ?> +
diff --git a/index.php b/index.php index 913492e..2c8f951 100644 --- a/index.php +++ b/index.php @@ -1,11 +1,14 @@ "bochard's net home", + "meta" => [ + ["name" => "robots", "content" => "index,follow"], + ["name" => "description", "content" => "the internet home of bochard - computers, pics, weblogs, and more..."] + ] +]); ?> +
diff --git a/info.php b/info.php index 5ee4b18..d06b3df 100644 --- a/info.php +++ b/info.php @@ -1,11 +1,13 @@ "about me", + "meta" => [ + ["name" => "description", "content" => "wanna know more about the creator of this site???"] + ] +]); ?> +
diff --git a/links.php b/links.php index e45c19b..0e4ce13 100644 --- a/links.php +++ b/links.php @@ -1,25 +1,27 @@ "cool links", + "meta" => [ + ["name" => "description", "content" => "some links that I found awesome."] + ] +]); ?> - -
-
- - - -
-

here are some really cool links I found...

- I seldomly update this page. If you have a cool web site and would like to add here in the list, consider sending me an email. -

- 2025, Dec. 17 - Ian Feggen's website - "Professor Shoelace" -
- 2025, Dec. 17 - dvd3000 - I think, this is best web site I found XD -
-
+ + +
+ + + + +
+

here are some really cool links I found...

+ I seldomly update this page. If you have a cool web site and would like to add here in the list, consider sending me an email. +

+ 2025, Dec. 17 - Ian Feggen's website - "Professor Shoelace" +
+ 2025, Dec. 17 - dvd3000 - I think, this is best web site I found XD +
+
diff --git a/part/head.php b/part/head.php index 83d8459..3178666 100644 --- a/part/head.php +++ b/part/head.php @@ -1,30 +1,69 @@ - - - - - - - - <?= htmlspecialchars($pgtitle, ENT_COMPAT);?> - "; +function head(array $head = []) { + $title = $head['title'] ?? "no title"; + $meta = $head['meta'] ?? []; + $css = $head['css'] ?? []; + $js = $head['js'] ?? []; + $favicon = $head['favicon'] ?? "/image/icon/pink-chair.png"; + + // default meta tags + $defaultMeta = [ + ["name" => "robots", "content" => "index, follow"], + ["name" => "description", "content" => "no description..."] + ]; + + foreach($defaultMeta as $default) { + $doesExist = false; + foreach($meta as $tag) { + if(isset($tag['name']) && strtolower($tag['name']) === strtolower($default['name'])) { + $doesExist = true; + break; } - ?> - - "> - - "> - - - - - - - - + + + + + <?= htmlspecialchars($title, ENT_COMPAT);?> + "> + $val) { + $output .= " " . htmlspecialchars($key, ENT_COMPAT) . "=\"" . htmlspecialchars($val, ENT_COMPAT) . "\""; + } + echo "\n\t"; + } + ?> + + + "> + + + "> + + + + + + + + + + "my photo album" +]); ?> +
diff --git a/weblog/.template b/weblog/.template index 891d378..ef9876b 100644 --- a/weblog/.template +++ b/weblog/.template @@ -1,11 +1,10 @@ "" +]); ?> +
diff --git a/weblog/20250712.php b/weblog/20250712.php index a0db960..944a234 100644 --- a/weblog/20250712.php +++ b/weblog/20250712.php @@ -1,11 +1,10 @@ "A dream." +]); ?> +
diff --git a/weblog/20250714.php b/weblog/20250714.php index cbbbffe..54cf7fc 100644 --- a/weblog/20250714.php +++ b/weblog/20250714.php @@ -1,11 +1,10 @@ "The rain." +]); ?> +
diff --git a/weblog/20250803.php b/weblog/20250803.php index 5eaf2f7..e9de504 100644 --- a/weblog/20250803.php +++ b/weblog/20250803.php @@ -1,11 +1,10 @@ "New haircut" +]); ?> +
diff --git a/weblog/20250805.php b/weblog/20250805.php index 1704249..9c6bf1f 100644 --- a/weblog/20250805.php +++ b/weblog/20250805.php @@ -1,11 +1,10 @@ "University orientation" +]); ?> +
diff --git a/weblog/20250809.php b/weblog/20250809.php index ba861d4..62e94c4 100644 --- a/weblog/20250809.php +++ b/weblog/20250809.php @@ -1,11 +1,10 @@ "Our kitten died" +]); ?> +
diff --git a/weblog/index.php b/weblog/index.php index 9b8472c..71260ca 100644 --- a/weblog/index.php +++ b/weblog/index.php @@ -1,11 +1,13 @@ "weblog", + "meta" => [ + ["name" => "description", "content" => "my thoughts..."] + ] +]); ?> +