Add OpenGraph SearchAction

This commit is contained in:
2023-01-01 17:53:56 +01:00
parent b7c6d4de4f
commit e85ef8974e
4 changed files with 8 additions and 34 deletions

View File

@ -25,7 +25,7 @@ Translating:
------------ ------------
The scrip `update-translations.sh` can be used to update the language template and translation files from source. The scrip `update-translations.sh` can be used to update the language template and translation files from source.
It will generate the file `locale/main-website.pot` which you can then use as basis to create a new language file in `YOUR_LANG_CODE/LC_MESSAGES/main-website.po` and edit it with a translation program, such as [Poedit](https://poedit.net/). It will generate the file `locale/onion-link-list.pot` which you can then use as basis to create a new language file in `YOUR_LANG_CODE/LC_MESSAGES/onion-link-list.po` and edit it with a translation program, such as [Poedit](https://poedit.net/).
Once you are done, you can open a pull request, or [email me](mailto:daniel@danwin1210.de), to include the translation. Once you are done, you can open a pull request, or [email me](mailto:daniel@danwin1210.de), to include the translation.
Live Demo: Live Demo:

View File

@ -1,40 +1,12 @@
<?php <?php
/*
* Onion Link List - Setup
*
* Copyright (C) 2016-2020 Daniel Winzen <daniel@danwin1210.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if(!extension_loaded('gettext')){ if(!extension_loaded('gettext')){
die('The gettext extension of PHP is required. Please install it first.'); die('The gettext extension of PHP is required. Please install it first.' . PHP_EOL);
} }
require_once(__DIR__.'/common_config.php'); require_once(__DIR__.'/common_config.php');
if(!extension_loaded('pdo_mysql')){ foreach(['pdo_mysql', 'json', 'pcre', 'curl', 'intl'] as $required_extension) {
die(_('The pdo_mysql extension of PHP is required. Please install it first.')); if ( ! extension_loaded( 'pdo_mysql' ) ) {
} die( sprintf(_( 'The %s extension of PHP is required. Please install it first.' ), $required_extension) . PHP_EOL );
if(!extension_loaded('pcre')){ }
die(_('The pcre extension of PHP is required. Please install it first.'));
}
if(!extension_loaded('json')){
die(_('The json extension of PHP is required. Please install it first.'));
}
if(!extension_loaded('curl')){
die(_('The curl extension of PHP is required. Please install it first.'));
}
if(!extension_loaded('date')){
die(_('The date extension of PHP is required. Please install it first.'));
} }
try{ try{
$db=new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME . ';charset=utf8mb4', DBUSER, DBPASS, [PDO::ATTR_ERRMODE=>PDO::ERRMODE_WARNING, PDO::ATTR_PERSISTENT=>PERSISTENT]); $db=new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME . ';charset=utf8mb4', DBUSER, DBPASS, [PDO::ATTR_ERRMODE=>PDO::ERRMODE_WARNING, PDO::ATTR_PERSISTENT=>PERSISTENT]);

View File

@ -16,6 +16,7 @@ asort($categories);
<!DOCTYPE html><html lang="<?php echo $language; ?>" dir="<?php echo $dir; ?>"><head> <!DOCTYPE html><html lang="<?php echo $language; ?>" dir="<?php echo $dir; ?>"><head>
<title><?php echo _('Admin interface'); ?></title> <title><?php echo _('Admin interface'); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Daniel Winzen">
<meta name=viewport content="width=device-width, initial-scale=1"> <meta name=viewport content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex"> <meta name="robots" content="noindex">
<link rel="canonical" href="<?php echo CANONICAL_URL . $_SERVER['SCRIPT_NAME']; ?>"> <link rel="canonical" href="<?php echo CANONICAL_URL . $_SERVER['SCRIPT_NAME']; ?>">

View File

@ -111,6 +111,7 @@ function send_html(): void
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: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:url" content="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '">';
echo '<meta property="og:locale" content="' . $locale . '">'; echo '<meta property="og:locale" content="' . $locale . '">';
echo '<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebSite","url":"'.CANONICAL_URL.'","potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"'.CANONICAL_URL.'/?q={search_term_string}"},"query-input":"required name=search_term_string","url":"'.CANONICAL_URL.'"}}</script>';
echo '<style>'.$style.'</style>'; echo '<style>'.$style.'</style>';
echo '<base target="_blank">'; echo '<base target="_blank">';
echo '</head><body><main>'; echo '</head><body><main>';