diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-11-28 11:29:45 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-11-28 11:29:45 +0100 |
commit | 12863dd293b84ef2d7f74120623d55e6254b7d5b (patch) | |
tree | 3d5b5d59589c02f7c5f180b317127b3af18aa79b /index.php | |
parent | 602edf5aaabc3fcaecfc9885d699156de089f8b0 (diff) |
add title and head
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -15,6 +15,8 @@ $url['query'] ??= ''; $client = new Client($geminiHost); $response = $client->request("$url[path]$url[query]"); +$title = ''; + if ($response->getStatusCode()->value == 20) { ob_start(); $mime = explode(';', $response->getMeta())[0]; @@ -45,6 +47,10 @@ if ($response->getStatusCode()->value == 20) { echo "</pre>"; } else if ($line['type'] === 'heading') { + if (empty($title)) { + $title = $line['text']; + } + echo "<h$line[size]>$line[text]</h$line[size]>"; } else if ($line['type'] === 'listitem') { @@ -98,6 +104,7 @@ if ($response->getStatusCode()->value == 20) { echo "Unhandled MIME type: $mime"; } } else { + $title = $response->getHeader(); echo $response->getHeader(); } @@ -109,6 +116,9 @@ $content = ob_get_clean(); <!doctype html> <html> <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title><?php echo $title; ?></title> </head> <body> <?php echo $content; ?> |