Releases: webitproff/seoarticle
Release list
First Release
SeoArticle Plugin for Cotonti
The SeoArticle plugin enhances the SEO capabilities of the Cotonti CMF's Pages module by adding meta tags, Open Graph, Twitter Card, Schema.org structured data, keyword extraction, reading time estimation, and related articles functionality.
Tested
Cotonti CMF v.0.9.26 beta on PHP v.8.2.25
File Structure
plugins/seoarticle/
├── inc/
│ └── seoarticle.functions.php # Functions for keyword extraction and reading time estimation
├── lang/
│ └── seoarticle.ru.lang.php # Russian translations and stop words for keyword extraction
│ └── seoarticle.en.lang.php # English translations and stop words for keyword extraction
├── seoarticle.header.tags.php # Overrides HEADER_META_DESCRIPTION and HEADER_META_KEYWORDS
├── seoarticle.page.main.php # Adds Open Graph, Twitter Card, and Schema.org meta tags
├── seoarticle.page.tags.php # Defines page tags (e.g., PAGE_READ_TIME, PAGE_AUTHOR, RELATED_ROW_*)
└── seoarticle.setup.php # Plugin configuration and setup
File Descriptions
- seoarticle.setup.php: Defines plugin metadata (name, version, author) and dependencies.
- seoarticle.header.tags.php: Overrides
{HEADER_META_DESCRIPTION}and{HEADER_META_KEYWORDS}for meta tags, ensuring single-line descriptions and keyword extraction. - seoarticle.page.main.php: Generates Open Graph, Twitter Card, and Schema.org meta tags, including title, description, keywords, author, and image.
- seoarticle.functions.php: Contains
cot_extract_keywords(extracts keywords with stop words filtering) andcot_estimate_read_time(estimates reading time, handles HTML/BBCode). - seoarticle.ru.lang.php: Provides Russian translations for labels (e.g., "Related articles") and stop words for keyword extraction.
- seoarticle.en.lang.php: Provides English translations for labels (e.g., "Related articles") and stop words for keyword extraction.
- seoarticle.page.tags.php: Adds tags like
{PAGE_READ_TIME},{PAGE_AUTHOR}, and{RELATED_ROW_*}for related articles (See seoarticle.page.tags.php ).
Features
- Meta Tags:
- Generates
<meta name="description">and<meta name="keywords">based onpage_metadesc,page_keywords, or extracted frompage_text. - Ensures single-line descriptions without line breaks.
- Generates
- Open Graph and Twitter Card:
- Adds
og:title,og:description,og:image,twitter:card, etc., for social media sharing.
- Adds
- Schema.org:
- Includes structured data for articles (
headline,description,keywords,author,image).
- Includes structured data for articles (
- Keyword Extraction:
- Automatically extracts keywords from
page_textusingcot_extract_keywordsifpage_keywordsis empty. - Supports stop words (e.g., "и, в, на") defined in
seoarticle.ru.lang.php.
- Automatically extracts keywords from
- Reading Time Estimation:
- Calculates reading time with
cot_estimate_read_time(200 words/minute, minimum 1 minute). - Handles HTML and BBCode in
page_text.
- Calculates reading time with
- Related Articles:
- Displays related articles with title, description, and image (
page_link_main_image).
- Displays related articles with title, description, and image (
- Author Information:
- Shows author name from
cot_usersor "Unknown author" if not found.
- Shows author name from
Installation
Prerequisites
- Cotonti CMF (tested with Siena).
- Pages module enabled.
- MySQL/MariaDB database.
Steps
-
Download the Plugin:
-
Clone or download the repository from GitHub:
git clone https://github.com/webitproff/seoarticle.git
-
Or download the ZIP and extract to
/plugins/seoarticle/.
-
-
Copy Files:
-
Place the
seoarticlefolder in/plugins/of your Cotonti installation:public_html/plugins/seoarticle/
-
-
Install the Plugin:
- Go to Administration → Extensions in the Cotonti admin panel.
- Find SeoArticle in the list and click Install.
- The plugin will register itself using
seoarticle.setup.php.
-
Configure Extra Fields:
- Go to Administration → Structure → Pages → Extra fields.
- Add an extra field for images:
- Code:
link_main_image - Type: URL
- Description: Main image for Open Graph and related articles
- Code:
- Ensure
page_metadesc,page_metatitle, andpage_keywordsare available (default in Cotonti).
-
Update Templates:
-
Open
/themes/CleanCot/header.tpland ensure it includes:<meta name="description" content="{HEADER_META_DESCRIPTION}" /> <meta name="keywords" content="{HEADER_META_KEYWORDS}" /> <!-- IF {PHP.out.meta} -->{PHP.out.meta}<!-- ENDIF -->
-
Open
/themes/cleancot/page.tpl(download theme) and add:<!-- IF {PHP|cot_plugin_active('seoarticle')} --> <!-- IF {RELATED_PAGES} --> <div class="related"> <!-- BEGIN: MAIN.RELATED_PAGES.RELATED_ROW --> <a href="{RELATED_ROW_URL}"> <div class="position-relative overflow-hidden rounded-5 shadow-bottom" style="aspect-ratio: 2 / 1;"> <!-- Условие Cotonti: проверка наличия главного изображения через экстраполяцию --> <!-- IF {RELATED_ROW_LINK_MAIN_IMAGE} --> <!-- Главное изображение страницы из Cotonti, адаптивное с обрезкой --> <img src="{RELATED_ROW_LINK_MAIN_IMAGE}" alt="{RELATED_ROW_TITLE}" class="img-fluid object-fit-cover"> <!-- Альтернатива: если главного изображения нет --> <!-- ELSE --> <!-- Дефолтное изображение из темы Cotonti --> <img src="{PHP.cfg.themes_dir}/{PHP.cfg.defaulttheme}/img/cotonti-cleancot.webp" alt="{PAGE_TITLE}" class="img-fluid object-fit-cover"> <!-- Конец условия изображения --> <!-- ENDIF --> </div> <h3 class="h5 mb-0">{RELATED_ROW_TITLE}</h3> <p>{RELATED_ROW_DESC}</p> </a> <!-- END: MAIN.RELATED_PAGES.RELATED_ROW --> </div> <!-- ENDIF --> <!-- ENDIF -->
-
and
<!-- IF {PHP|cot_plugin_active('seoarticle')} -->
{PAGE_READ_TIME}
<!-- ENDIF -->
-
Clear Cache:
- go to Administration → Cache → Clear cache.
-
Test the Plugin:
- Create or edit a page in Administration → Pages.
- Fill
page_metadesc,page_keywords,page_metatitle, andpage_link_main_image(optional). - View the page and check:
<meta name="description">and<meta name="keywords">in<head>.- Open Graph and Schema.org tags.
- Reading time (
{PAGE_READ_TIME}), author ({PAGE_AUTHOR}), and related articles.
Recommendations
-
Use Meta Fields:
- Always fill
page_metadesc,page_keywords, andpage_metatitlein the page editor for precise SEO control. - Use
page_link_main_imagefor better social media previews.
- Always fill
-
Stop Words:
-
Extend stop words in
/plugins/seoarticle/lang/seoarticle.ru.lang.phpfor better keyword extraction:$L['seoarticle_stop_words'] = 'и,в,на,с,по,для,это,как,что,а,у,к,от,до,при,о,без,если';
-
-
Database Optimization:
- Ensure indexes on
cot_pages(page_id,page_ownerid,page_cat) andcot_users(user_id) for faster queries.
- Ensure indexes on
-
Testing:
- Use browser developer tools to verify meta tags and structured data.
- Test related articles by creating multiple pages in the same category.
Warnings
-
Template Conflicts:
- Ensure
{HEADER_META_DESCRIPTION}and{HEADER_META_KEYWORDS}are not duplicated inheader.tplto avoid multiple meta tags. - Check
<head>for duplicate<meta name="description">or<meta name="keywords">.
- Ensure
-
Extra Fields:
- If
page_link_main_imageis not configured, the plugin falls back to/images/default.jpg. Set a valid default image inseoarticle.page.main.phpif needed.
- If
-
Performance:
- Keyword extraction (
cot_extract_keywords) may be slow for very longpage_text. Limit text length or cache results if necessary.
- Keyword extraction (
-
Language Support:
- The plugin includes only Russian translations (
seoarticle.ru.lang.php). Add other languages (e.g.,seoarticle.en.lang.php) for multilingual sites.
- The plugin includes only Russian translations (
-
Dependencies:
- Requires the Pages module. Ensure it is enabled before installation.
- Database queries assume
cot_usersandcot_structuretables are intact.
License
BSD License. See LICENSE for details.
Author
webitproff 22 April 2025
#############
Русский
#############
Плагин SeoArticle для Cotonti
Плагин SeoArticle расширяет SEO-возможности модуля Pages в Cotonti CMF, добавляя мета-теги, Open Graph, Twitter Card, структурированные данные Schema.org, извлечение ключевых слов, оценку времени чтения и функционал связанных статей.
Протестировано
Cotonti CMF v.0.9.26 beta на PHP v.8.2.25
Структура файлов
plugins/seoarticle/
├── inc/
│ └── seoarticle.functions.php # Функции для извлечения ключевых слов и оценки времени чтения
├── lang/
│ └── seoarticle.ru.lang.php # Русские переводы и стоп-слова для извлечения ключевых слов
│ └── seoarticle.en.lang.php # Английские переводы и стоп-слова для извлечения ключевых слов
├── seoarticle.header.tags.php # Переопределяет HEADER_META_DESCRIPTION и HEADER_META_KEYWORDS
├── seoarticle.page.main.php # Добавляет мета-теги Open Graph, Twitter Card и Schema.org
├── seoarticle.page.tags.php # Определяет теги страницы (например, PAGE_READ_TIME, PAGE_AUTHOR, RELATED_ROW_*)
└── seoarticle.setup.php # Конфигурация и установка плагина
Описание файлов
- seoarticle.setup.php: Определяет метаданные плагина (название, версия, автор) и зависимости.
- seoarticle.header.tags.php: Переопределяет
{HEADER_META_DESCRIPTION}...