Add OpenGraph tags

This commit is contained in:
2022-12-30 12:16:46 +01:00
parent 53baf2c9e8
commit b7c6d4de4f
3 changed files with 13 additions and 2 deletions

View File

@ -170,5 +170,6 @@ function alt_links(): void
$canonical_query['lang'] = $lang; $canonical_query['lang'] = $lang;
$link = CANONICAL_URL . ($_SERVER['SCRIPT_NAME'] === '/index.php' ? '/' : $_SERVER['SCRIPT_NAME']) . '?' . http_build_query($canonical_query); $link = CANONICAL_URL . ($_SERVER['SCRIPT_NAME'] === '/index.php' ? '/' : $_SERVER['SCRIPT_NAME']) . '?' . http_build_query($canonical_query);
echo '<link rel="alternate" href="'.$link.'" hreflang="'.$lang.'" />'; echo '<link rel="alternate" href="'.$link.'" hreflang="'.$lang.'" />';
echo '<meta property="og:locale:alternate" content="'.$data['locale'].'">';
} }
} }

View File

@ -22,7 +22,7 @@ if(!isset($_REQUEST['format'])){
function send_html(): void function send_html(): void
{ {
global $categories, $db, $language, $dir; global $categories, $db, $language, $dir, $locale;
$numrows = 0; $numrows = 0;
$style = '.row{display:flex;flex-wrap:wrap}.headerrow{font-weight:bold}.col{display:flex;flex:1;padding:3px 3px;flex-direction:column}'; $style = '.row{display:flex;flex-wrap:wrap}.headerrow{font-weight:bold}.col{display:flex;flex:1;padding:3px 3px;flex-direction:column}';
$style .= '.red{color:red}.green{color:green}.up .col:nth-child(0n+3){background-color:#aaff88}.down .col:nth-child(0n+3){background-color:#ff4444}'; $style .= '.red{color:red}.green{color:green}.up .col:nth-child(0n+3){background-color:#aaff88}.down .col:nth-child(0n+3){background-color:#ff4444}';
@ -106,6 +106,11 @@ function send_html(): void
echo '<link rel="canonical" href="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '">'; echo '<link rel="canonical" href="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '">';
echo '<link rel="alternate" href="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '" hreflang="x-default">'; echo '<link rel="alternate" href="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '" hreflang="x-default">';
alt_links(); alt_links();
echo '<meta property="og:type" content="website">';
echo '<meta property="og:title" content="' . _('Onion link list') . '">';
echo '<meta property="og:description" content="' . _('Huge link list of Tor hidden service onions. All the darknet links you need in one place.') . '">';
echo '<meta property="og:url" content="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '">';
echo '<meta property="og:locale" content="' . $locale . '">';
echo '<style>'.$style.'</style>'; echo '<style>'.$style.'</style>';
echo '<base target="_blank">'; echo '<base target="_blank">';
echo '</head><body><main>'; echo '</head><body><main>';

View File

@ -1,6 +1,6 @@
<?php <?php
require_once(__DIR__.'/../common_config.php'); require_once(__DIR__.'/../common_config.php');
global $language, $dir; global $language, $dir, $locale;
$style = '.red{color:red}.green{color:green}.software-link{text-align:center;font-size:small}.list{padding:0;}.list li{display:inline-block;padding:0.35em}'; $style = '.red{color:red}.green{color:green}.software-link{text-align:center;font-size:small}.list{padding:0;}.list li{display:inline-block;padding:0.35em}';
send_headers([$style]); send_headers([$style]);
echo '<!DOCTYPE html><html lang="'.$language.'" dir="'.$dir.'"><head>'; echo '<!DOCTYPE html><html lang="'.$language.'" dir="'.$dir.'"><head>';
@ -12,6 +12,11 @@ echo '<meta name="description" content="'._('Test whether a Tor hidden service o
echo '<link rel="canonical" href="' . CANONICAL_URL . $_SERVER['SCRIPT_NAME'] . '">'; echo '<link rel="canonical" href="' . CANONICAL_URL . $_SERVER['SCRIPT_NAME'] . '">';
echo '<link rel="alternate" href="' . CANONICAL_URL . $_SERVER['SCRIPT_NAME'] . '" hreflang="x-default">'; echo '<link rel="alternate" href="' . CANONICAL_URL . $_SERVER['SCRIPT_NAME'] . '" hreflang="x-default">';
alt_links(); alt_links();
echo '<meta property="og:type" content="website">';
echo '<meta property="og:title" content="' . _('Online-Test') . '">';
echo '<meta property="og:description" content="' . _('Test whether a Tor hidden service onion is online or offline') . '">';
echo '<meta property="og:url" content="' . CANONICAL_URL . $_SERVER['SCRIPT_NAME'] . '">';
echo '<meta property="og:locale" content="' . $locale . '">';
echo '<style>'.$style.'</style>'; echo '<style>'.$style.'</style>';
echo '</head><body><main>'; echo '</head><body><main>';
echo '<h1>'._('Online-Test').'</h1>'; echo '<h1>'._('Online-Test').'</h1>';