Forum categories

Мини плагин «Recent Items MetaDescription» в три файла

Дополнение к плагину "RecentItems" для Cotonti - Пользовательское описание для мета-тега - "meta name=description" на странице нового и обновленного контента.


webitproff
webitproff • 2024-01-27 18:28 #1

Дополнение к плагину "RecentItems" для Cotonti - Пользовательское описание для мета-тега - "meta name=description" на странице нового и обновленного контента.

1. В папке плагинов  -  "plugins" создаем папку "recentitemsmetadesc".

2. В папке "recentitemsmetadesc" создаем файл установки и конфигурации - "recentitemsmetadesc.setup.php"

в это файл копируем код ниже:

<?php

/* ====================
[BEGIN_COT_EXT]
Code=recentitemsmetadesc
Name=Recent Items MetaDescription
Category=
Description= 
Version=1.0.0
Date=27.07.2024
Author=Webitproff
Copyright=Copyright (c)
Notes=
Auth_guests=R
Lock_guests=12345A
Auth_members=R
Lock_members=12345A
Requires_modules=
Requires_plugins=recentitems
[END_COT_EXT]

[BEGIN_COT_EXT_CONFIG]
textfromconfig=01:string::Новости и обновления на сайте в статьях и блогах, новые сообщения на форуме сообщества участников торговой площадки цифровых товаров и фриланс услуг:
[END_COT_EXT_CONFIG]
==================== */

3. В папке "recentitemsmetadesc" создаем файл с хуком - "recentitemsmetadesc.recentitems.tags.php"

в него копируем код ниже

<?php
/* ====================
  [BEGIN_COT_EXT]
  Hooks=recentitems.tags
  [END_COT_EXT]
  ==================== */

defined('COT_CODE') or die('Wrong URL');

if (cot_plugin_active('recentitems')) {
	require_once cot_incfile('recentitems', 'plug');
	$metaDesc = Cot::$cfg['plugin']['recentitemsmetadesc']['textfromconfig'];
	Cot::$out['desc'] = $metaDesc;
}

4. В папке "recentitemsmetadesc" создаем папку "lang", а в ней создаем файл "recentitemsmetadesc.ru.lang.php".

копируем тут код, который ниже

<?php
/**
 * Russian Language File for Recent Items MetaDescription
 *
 * @package RecentItemsMetaDescription
 * @copyright (c) Cotonti
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */

defined('COT_CODE') or die('Wrong URL.');

/**
 * Plugin Info
 */
$L['info_desc'] = 'Пользовательское описание для мета-тега - "meta name=description" на странице нового и обновленного контента.';

/**
 * Plugin Config
 */
$L['cfg_textfromconfig'] = 'Текст вашего описания в мета-теге';

5. Идем в админку, в расширениях скролим до плагина «Recent Items MetaDescription», заходим в карточку расширения.

Жмем "Установить", затем "Конфигрурация" и прописуем свой текст мета-описания.

Готово. Дисковый кэш чистим, и проверяем страницу сайта по адресу:

https://My_Domain.com/recentitems

Но если вы до сих пор не настроили на своем сайте плагин `URL Editor`, то ссылка у вас будет иметь вид:

https://My_Domain.com/index.php?e=recentitems

 

This post was edited by webitproff (2024-01-27 18:39, 2 years ago)
1/1/0

🗿

🧙‍♂️ Well met, good traveler! Fate has guided your steps to our humble realm. Here, wise sages and masters of the coding craft ⚒️📜 gather to unravel the mysteries of the code ✨⚙️, share their knowledge, and add new chapters to our chronicles.
⬅️ To the left lie ancient scrolls 📚 filled with forgotten wisdom. ⬆️ Straight ahead, friendly folk offer counsel 💬 to those in need. ➡️ To the right, you may become a chronicler ✍️ yourself, sharing your craft and leaving words of wisdom for those yet to come.
📝 Delay no longer—tell us the name by which you are known, complete the rite of registration 🛡️, and join our fellowship!
🏰 Our brotherhood holds no secret initiation, yet many halls remain closed to wandering guests, for some knowledge 💎 is reserved for those who choose to walk this path beside us.