Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
77a6f18
initial commit for jacademyseo_opengraph plugin for joomla seo improv…
shahzan01 Jun 2, 2025
eb22627
feat : added manifest and language files for jacademyseo_opengraph pl…
shahzan01 Jun 3, 2025
ece1af5
fix : rename plugin to opengraph and update language files
shahzan01 Jun 4, 2025
905cca3
fix : file name changed to opengraph.php
shahzan01 Jun 4, 2025
085ff65
feat: added forms for article and category to opengraph plugin
shahzan01 Jun 5, 2025
8cb7864
feat : add og tag injection into html
shahzan01 Jun 12, 2025
ce47b06
fix : added docblocks and comments
shahzan01 Jun 16, 2025
7ba727c
feat : form improvements - custom fields mapping and manual override …
shahzan01 Jun 18, 2025
768a2bf
feat : created opengraph service interface and field type for opengra…
shahzan01 Jun 19, 2025
6b71fbf
feat: add opengraph field mapping and form changes
shahzan01 Jun 24, 2025
2fac558
fix : updated form and used the interface check to render form
shahzan01 Jun 24, 2025
4b65016
Segregate fields for opengraph into different form dropdowns
shahzan01 Jun 26, 2025
89149f9
fix : Separated the mapping form and conditionally combined them only…
shahzan01 Jul 1, 2025
b05a861
fix : forms now correclty save values in both category and article
shahzan01 Jul 2, 2025
b41f698
feat : added custom fields options to opengraph mappings and used gro…
shahzan01 Jul 3, 2025
a6e28cd
fix : made some changes to the form and made isSupported function mor…
shahzan01 Jul 8, 2025
fea4185
feat : implemented the OGInterface in com_menus
shahzan01 Jul 8, 2025
6d37b9b
feat: add custom fields filtering to opengraph field
shahzan01 Jul 14, 2025
7cfde55
feat : og tag injection into html
shahzan01 Jul 17, 2025
1f95b29
fix : used the component helper to get the article and category
shahzan01 Jul 22, 2025
19fe1f7
fix : get custom fields for the respective category in dropdown
shahzan01 Jul 23, 2025
cbbff6c
Chore: Apply PHP-CS-Fixer formatting across the codebase
shahzan01 Jul 23, 2025
419dfa7
Chore: Normalize line endings and fix code style via PHPCBF
shahzan01 Jul 23, 2025
928ad4b
feat : add string sanitization and truncate to the plugin
shahzan01 Jul 29, 2025
063adfa
fix : sorted language strings
shahzan01 Jul 29, 2025
8a9441b
feat : added the javascript to auto update the placeholder values in …
shahzan01 Jul 31, 2025
30689d6
feat : added script for OpenGraph placeholder in build folder
shahzan01 Aug 5, 2025
8f94056
removed the custom field logic from this branch
shahzan01 Aug 5, 2025
c215b7a
fix : fix some bugs and modified the plugins settings page
shahzan01 Aug 7, 2025
53b3576
chore : changed opengraph.xml to use JYES/JNO instead of JENABLED/JDI…
shahzan01 Aug 7, 2025
9db1b2c
feat : added global default option in the settings and refactored Ope…
shahzan01 Aug 11, 2025
ff3a891
feat : made the OpenGraph field more flexible , removed hardcoded com…
shahzan01 Aug 15, 2025
3e47961
feat : added support for multi article page view
shahzan01 Sep 1, 2025
e63a335
fix : run php-cs-fixer and sorted language strings
shahzan01 Sep 1, 2025
e2f0c94
Merge remote-tracking branch 'Academy2025_SEO/6.1-dev' into academy/2…
bembelimen Sep 12, 2025
7e7aaea
fix : Check PHP code style fixes
shahzan01 Sep 15, 2025
775bc4b
Merge branch 'feature/seo-improvements' of https://github.com/joomla-…
shahzan01 Sep 15, 2025
0f8c467
fix : removed the phpstan error
shahzan01 Sep 15, 2025
64bf434
fix : many minor fixes and improvements for SEO plugin
shahzan01 Sep 30, 2025
a635837
fix : PHP-CS-Fixer applied
shahzan01 Sep 30, 2025
5b33522
fixed the function call to include the missing parameter.
shahzan01 Sep 30, 2025
27b2c30
fix : removed the hardcoded component name 'com_content' to make it d…
shahzan01 Sep 30, 2025
a8d5996
fix : made the OpenGraph plugin more generic to support other content…
shahzan01 Oct 1, 2025
10b1014
fix : added fallback for getModelName method if not exists in component
shahzan01 Oct 1, 2025
bdc382e
fix : changed $cmp to $component to avoid confusion and potential iss…
shahzan01 Oct 1, 2025
b721d72
fix : minor fixes and improvements
shahzan01 Oct 2, 2025
78a4e3b
fix : added getmodelname method to opengraph service interface and re…
shahzan01 Oct 3, 2025
1a98cc5
fix : add getModelName to MenusComponent
shahzan01 Oct 3, 2025
edd13bf
fix : Rename opengraph.php to Opengraph.php for consistency
shahzan01 Oct 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Joomla\CMS\Helper\ContentHelper as LibraryContentHelper;
use Joomla\CMS\HTML\HTMLRegistryAwareTrait;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Opengraph\OpengraphServiceInterface;
use Joomla\CMS\Schemaorg\SchemaorgServiceInterface;
use Joomla\CMS\Schemaorg\SchemaorgServiceTrait;
use Joomla\CMS\Tag\TagServiceInterface;
Expand Down Expand Up @@ -53,7 +54,8 @@ class ContentComponent extends MVCComponent implements
SchemaorgServiceInterface,
WorkflowServiceInterface,
RouterServiceInterface,
TagServiceInterface
TagServiceInterface,
OpengraphServiceInterface
{
use AssociationServiceTrait;
use RouterServiceTrait;
Expand Down Expand Up @@ -204,6 +206,65 @@ public function getSchemaorgContexts(): array
return $contexts;
}


/**
* Returns a grouped list of mappable fields used by the OpengraphField.
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
public function getOpengraphFields(): array
{
Factory::getApplication()->getLanguage()->load('com_content', JPATH_ADMINISTRATOR);

$fields = [
'text-fields' => [
'title' => Text::_('JGLOBAL_TITLE'),
'articletext' => Text::_('COM_CONTENT_FIELD_ARTICLETEXT_LABEL'),
'alias' => Text::_('JFIELD_ALIAS_LABEL'),
'metadesc' => Text::_('JFIELD_META_DESCRIPTION_LABEL'),
],

'image-fields' => [
'image_intro' => Text::_('COM_CONTENT_FIELD_INTRO_LABEL'),
'image_fulltext' => Text::_('COM_CONTENT_FIELD_FULL_LABEL'),

],

'image-alt-fields' => [
'image_intro_alt' => Text::_('COM_CONTENT_FIELD_INTRO_LABEL') . ' - ' . Text::_('COM_CONTENT_FIELD_IMAGE_ALT_LABEL'),
'image_fulltext_alt' => Text::_('COM_CONTENT_FIELD_FULL_LABEL') . ' - ' . Text::_('COM_CONTENT_FIELD_IMAGE_ALT_LABEL'),
],

'meta-fields' => [
'metadesc' => Text::_('JFIELD_META_DESCRIPTION_LABEL'),
'metakey' => Text::_('JFIELD_META_KEYWORDS_LABEL'),
],


'locale-fields' => [
'language' => Text::_('JFIELD_LANGUAGE_LABEL'),
],

'author-fields' => [
'created_by' => Text::_('COM_CONTENT_FIELD_CREATED_BY_LABEL'),
'created_by_alias' => Text::_('COM_CONTENT_FIELD_CREATED_BY_ALIAS_LABEL'),
'modified_by' => Text::_('JGLOBAL_FIELD_MODIFIED_BY_LABEL'),

],
'date-fields' => [
'created' => Text::_('COM_CONTENT_FIELD_CREATED_LABEL'),
'modified' => Text::_('JGLOBAL_FIELD_MODIFIED_LABEL'),
'publish_up' => Text::_('COM_CONTENT_FIELD_PUBLISH_UP_LABEL'),
'publish_down' => Text::_('COM_CONTENT_FIELD_PUBLISH_DOWN_LABEL'),
],
];

return $fields;
}


/**
* Returns valid contexts
*
Expand Down Expand Up @@ -295,7 +356,6 @@ public function getModelName($context): string

return ucfirst($modelname);
}

/**
* Method to filter transitions by given id of state.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Joomla\CMS\Extension\BootableExtensionInterface;
use Joomla\CMS\Extension\MVCComponent;
use Joomla\CMS\HTML\HTMLRegistryAwareTrait;
use Joomla\CMS\Opengraph\OpengraphServiceInterface;
use Joomla\Component\Menus\Administrator\Service\HTML\Menus;
use Psr\Container\ContainerInterface;

Expand All @@ -29,7 +30,8 @@
*/
class MenusComponent extends MVCComponent implements
BootableExtensionInterface,
AssociationServiceInterface
AssociationServiceInterface,
OpengraphServiceInterface
{
use AssociationServiceTrait;
use HTMLRegistryAwareTrait;
Expand All @@ -51,4 +53,42 @@ public function boot(ContainerInterface $container)
{
$this->getRegistry()->register('menus', new Menus());
}


/**
* Returns a grouped list of mappable fields used by the OpengraphField.
*
* @return array
*
* @since __DEPLOY_VERSION__
*/
public function getOpengraphFields(): array
{

$fields = [];

return $fields;
}

/**
* Returns the model name, based on the context
*
* @param string $context
*
* @return string
*
* @since __DEPLOY_VERSION__
*/
public function getModelName($context): string
{
$parts = explode('.', $context);

if (\count($parts) < 2) {
return '';
}

array_shift($parts);

return ucfirst(array_shift($parts));
}
}
100 changes: 100 additions & 0 deletions administrator/language/en-GB/plg_system_opengraph.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
; Joomla! Project
; (C) 2025 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_SYSTEM_OPENGRAPH_ADVANCED_SECTION ="Advanced Settings"
PLG_SYSTEM_OPENGRAPH_DEFAULT_DESC_DESC="Fallback description for OpenGraph tags."
PLG_SYSTEM_OPENGRAPH_DEFAULT_DESC_LABEL="Default OG Description"
PLG_SYSTEM_OPENGRAPH_DEFAULT_IMAGE_ALT_DESC="Alt text for the default OpenGraph image."
PLG_SYSTEM_OPENGRAPH_DEFAULT_IMAGE_ALT_LABEL="Default OG Image Alt"
PLG_SYSTEM_OPENGRAPH_DEFAULT_IMAGE_DESC="Fallback image for OpenGraph (recommended 1200×630)."
PLG_SYSTEM_OPENGRAPH_DEFAULT_IMAGE_LABEL="Default OG Image"
PLG_SYSTEM_OPENGRAPH_DEFAULT_SITENAME_DESC="Fallback for og:site_name if you choose to include it."
PLG_SYSTEM_OPENGRAPH_DEFAULT_SITENAME_LABEL="Default Site Name"
PLG_SYSTEM_OPENGRAPH_DEFAULT_TITLE_DESC="Used when no title is mapped or provided by Menu/Category/Item."
PLG_SYSTEM_OPENGRAPH_DEFAULT_TITLE_LABEL="Default OG Title"
PLG_SYSTEM_OPENGRAPH_DESCRIPTION="Open Graph Plugin automatically generates Open Graph tags for improved social media sharing. Features hierarchical override system supporting global, category, and article-level metadata configuration."
PLG_SYSTEM_OPENGRAPH_DESCRIPTION_FIELD_DESC="Select which article field to use for og:description meta tag. Meta description is preferred over article text."
PLG_SYSTEM_OPENGRAPH_DESCRIPTION_FIELD_LABEL="Description Source"
PLG_SYSTEM_OPENGRAPH_ENABLE_DESC="Enable OpenGraph tags for this content."
PLG_SYSTEM_OPENGRAPH_ENABLE_LABEL="Enable OpenGraph"
PLG_SYSTEM_OPENGRAPH_ENABLE_OG_GENERATION="Enable OpenGraph"
PLG_SYSTEM_OPENGRAPH_ENABLE_OG_GENERATION_DESC="Enable OpenGraph tags generation."
PLG_SYSTEM_OPENGRAPH_FB_APP_ID_DESC="Needed only for Facebook Insights."
PLG_SYSTEM_OPENGRAPH_FB_APP_ID_LABEL="Facebook App ID"
PLG_SYSTEM_OPENGRAPH_FEATURES_DESC="• Generates complete Open Graph and Twitter Card metadata on the fly.&#10;• Hierarchical override system: Menu → Article → Category → Global.&#10;• Auto‑picks intro/full images and alt text.&#10;• Smart sanitisation & trimming prevents broken previews."
PLG_SYSTEM_OPENGRAPH_FEATURES_LABEL="What this plugin does"
PLG_SYSTEM_OPENGRAPH_FIELDSET_ARTICLE="OpenGraph"
PLG_SYSTEM_OPENGRAPH_FIELDSET_ARTICLE_DESC="Configure OpenGraph metadata for social media sharing. These settings override global defaults."
PLG_SYSTEM_OPENGRAPH_FIELDSET_GLOBAL_DEFAULTS="Global Defaults"
PLG_SYSTEM_OPENGRAPH_FIELDSET_GLOBAL_DEFAULTS_DESC="Set site-wide OpenGraph fallback values. Menu and item-level settings will override these."
PLG_SYSTEM_OPENGRAPH_FIELD_MAPPING_SECTION="Field Mapping Configuration"
PLG_SYSTEM_OPENGRAPH_GLOBAL_DESC="Global defaults used when no article / menu overrides are present."
PLG_SYSTEM_OPENGRAPH_GLOBAL_OG_SETTINGS="Global Open Graph Settings"
PLG_SYSTEM_OPENGRAPH_GROUP_DEFAULT_FIELDS="Default Fields"
PLG_SYSTEM_OPENGRAPH_IMAGE_ALT_FIELD_DESC="Select which article field to use for og:image:alt meta tag for accessibility"
PLG_SYSTEM_OPENGRAPH_IMAGE_ALT_FIELD_LABEL="Image Alt Text Source"
PLG_SYSTEM_OPENGRAPH_IMAGE_FIELD_DESC="Select which article field to use for og:image meta tag"
PLG_SYSTEM_OPENGRAPH_IMAGE_FIELD_LABEL="Image Source"
PLG_SYSTEM_OPENGRAPH_INHERITED="inherited from"
PLG_SYSTEM_OPENGRAPH_MANUAL_OVERRIDE_SECTION="Manual Override Options"
PLG_SYSTEM_OPENGRAPH_MAX_ALT_DESC="Recommended: ≤125 characters (based on WCAG guidelines)."
PLG_SYSTEM_OPENGRAPH_MAX_ALT_LABEL="Max Alt Text Length"
PLG_SYSTEM_OPENGRAPH_MAX_DESC_DESC="Recommended: ≤160 characters (Twitter truncates beyond this)."
PLG_SYSTEM_OPENGRAPH_MAX_DESC_LABEL="Max Description Length"
PLG_SYSTEM_OPENGRAPH_MAX_TITLE_DESC="Recommended: ≤60 characters for best display in Facebook and Twitter cards."
PLG_SYSTEM_OPENGRAPH_MAX_TITLE_LABEL="Max Title Length"
PLG_SYSTEM_OPENGRAPH_NO_FIELD_SELECTED="-- No Field Selected --"
PLG_SYSTEM_OPENGRAPH_OG_DESCRIPTION_DESC="Brief description for social media sharing. Recommended length: 120-160 characters."
PLG_SYSTEM_OPENGRAPH_OG_DESCRIPTION_HINT="Enter a brief, engaging description"
PLG_SYSTEM_OPENGRAPH_OG_DESCRIPTION_LABEL="OpenGraph Description"
PLG_SYSTEM_OPENGRAPH_OG_IMAGE_ALT_DESC="Alternative text for the OpenGraph image for accessibility."
PLG_SYSTEM_OPENGRAPH_OG_IMAGE_ALT_HINT="Enter a brief description of the image for accessibility"
PLG_SYSTEM_OPENGRAPH_OG_IMAGE_ALT_LABEL="OpenGraph Image Alt Text"
PLG_SYSTEM_OPENGRAPH_OG_IMAGE_DESC="Image for social media sharing. Recommended size: 1200x630 pixels."
PLG_SYSTEM_OPENGRAPH_OG_IMAGE_LABEL="OpenGraph Image"
PLG_SYSTEM_OPENGRAPH_OG_TITLE_DESC="Custom title for social media sharing. Recommended length: 40-60 characters."
PLG_SYSTEM_OPENGRAPH_OG_TITLE_HINT="Enter a compelling title for social sharing"
PLG_SYSTEM_OPENGRAPH_OG_TITLE_LABEL="OpenGraph Title"
PLG_SYSTEM_OPENGRAPH_OG_TYPE_DESC="Content type for social media platforms."
PLG_SYSTEM_OPENGRAPH_OG_TYPE_LABEL="OpenGraph Type"
PLG_SYSTEM_OPENGRAPH_OG_URL_DESC="Override the canonical URL for sharing."
PLG_SYSTEM_OPENGRAPH_OG_URL_HINT="Leave empty to use the article's URL"
PLG_SYSTEM_OPENGRAPH_OG_URL_LABEL="Custom URL"
PLG_SYSTEM_OPENGRAPH_OVERRIDE_SETTINGS="Override Settings"
PLG_SYSTEM_OPENGRAPH_OVERVIEW="Overview & Help"
PLG_SYSTEM_OPENGRAPH_QUICKSTART_DESC="1. Enable the plugin.&#10;2. Optional: enter your Facebook App ID above.&#10;3. Edit any article → ‘Open Graph’ tab to override title, description, or image.&#10;4. Clear cache, share your URL and enjoy rich previews!"
PLG_SYSTEM_OPENGRAPH_QUICKSTART_LABEL="How to use"
PLG_SYSTEM_OPENGRAPH_SHOW_ADVANCED_DESC="Show advanced settings for OpenGraph metadata."
PLG_SYSTEM_OPENGRAPH_SHOW_ADVANCED_LABEL="Show Advanced Settings"
PLG_SYSTEM_OPENGRAPH_SHOW_MANUAL_OVERRIDE_DESC="Enable this to manually set OG tags like title, description, and image."
PLG_SYSTEM_OPENGRAPH_SHOW_MANUAL_OVERRIDE_LABEL="Show Manual Override Settings"
PLG_SYSTEM_OPENGRAPH_TIPS_DESC="• Changed an image but Facebook still shows the old one? Clear Joomla & CDN caches, then run Facebook Sharing Debugger.&#10;• Large images (>5 MB) may be ignored by Twitter.&#10;• Verify that og:image is an absolute URL (use the built‑in sanitiser)."
PLG_SYSTEM_OPENGRAPH_TIPS_LABEL="Troubleshooting"
PLG_SYSTEM_OPENGRAPH_TITLE_FIELD_DESC="Select which article field to use for og:title meta tag"
PLG_SYSTEM_OPENGRAPH_TITLE_FIELD_LABEL="Title Source"
PLG_SYSTEM_OPENGRAPH_TWITTER_CARD_DESC="Select the type of Twitter card to use for this content."
PLG_SYSTEM_OPENGRAPH_TWITTER_CARD_LABEL="Twitter Card Type"
PLG_SYSTEM_OPENGRAPH_TWITTER_CARD_SUMMARY="Summary"
PLG_SYSTEM_OPENGRAPH_TWITTER_CARD_SUMMARY_LARGE_IMAGE="Summary Large Image"
PLG_SYSTEM_OPENGRAPH_TWITTER_DESC_DESC="Custom description for Twitter sharing. Recommended length: 120-160 characters."
PLG_SYSTEM_OPENGRAPH_TWITTER_DESC_HINT="Enter a brief, engaging description"
PLG_SYSTEM_OPENGRAPH_TWITTER_DESC_LABEL="Twitter Description"
PLG_SYSTEM_OPENGRAPH_TWITTER_IMAGE_DESC="Image for Twitter sharing. Recommended size: 1200x630 pixels."
PLG_SYSTEM_OPENGRAPH_TWITTER_IMAGE_LABEL="Twitter Image"
PLG_SYSTEM_OPENGRAPH_TWITTER_TITLE_DESC="Custom title for Twitter sharing. Recommended length: 70 characters."
PLG_SYSTEM_OPENGRAPH_TWITTER_TITLE_HINT="Enter a compelling title for Twitter sharing"
PLG_SYSTEM_OPENGRAPH_TWITTER_TITLE_LABEL="Twitter Title"
PLG_SYSTEM_OPENGRAPH_TYPE_ARTICLE="Article"
PLG_SYSTEM_OPENGRAPH_TYPE_BLOG="Blog"
PLG_SYSTEM_OPENGRAPH_TYPE_BOOK="Book"
PLG_SYSTEM_OPENGRAPH_TYPE_EVENT="Event"
PLG_SYSTEM_OPENGRAPH_TYPE_FIELD_DESC="Select a custom field to use as the OpenGraph type source."
PLG_SYSTEM_OPENGRAPH_TYPE_FIELD_LABEL="Type Field"
PLG_SYSTEM_OPENGRAPH_TYPE_MUSIC="Music"
PLG_SYSTEM_OPENGRAPH_TYPE_PRODUCT="Product"
PLG_SYSTEM_OPENGRAPH_TYPE_PROFILE="Profile"
PLG_SYSTEM_OPENGRAPH_TYPE_VIDEO="Video"
PLG_SYSTEM_OPENGRAPH_TYPE_WEBSITE="Website"
PLG_SYSTEM_OPENGRAPH_USE_DEFAULT="Use Default"
12 changes: 12 additions & 0 deletions administrator/language/en-GB/plg_system_opengraph.sys.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; Joomla! Project
; (C) 2025 Open Source Matters, Inc. <https://www.joomla.org>
; License GNU General Public License version 2 or later; see LICENSE.txt
; Note : All ini files need to be saved as UTF-8

PLG_SYSTEM_OPENGRAPH="System - Open Graph"
PLG_SYSTEM_OPENGRAPH_DESCRIPTION="Automatic Open Graph tag generation plugin for Joomla 6.x with hierarchical metadata override system. Improves social media sharing with intelligent fallback mechanisms."
PLG_SYSTEM_OPENGRAPH_FIELDS_GROUP="Open Graph Metadata"
PLG_SYSTEM_OPENGRAPH_FIELDS_GROUP_DESC="Custom fields for Open Graph metadata configuration"
PLG_SYSTEM_OPENGRAPH_INSTALL_SUCCESS="Open Graph Plugin installed successfully!"
PLG_SYSTEM_OPENGRAPH_UNINSTALL_SUCCESS="Open Graph Plugin uninstalled successfully!"
PLG_SYSTEM_OPENGRAPH_UPDATE_SUCCESS="Open Graph Plugin updated successfully!"
20 changes: 20 additions & 0 deletions build/media_source/plg_system_opengraph/joomla.asset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
"name": "plg_system_opengraph",
"version": " __DEPLOY_VERSION__",
"description": "Joomla CMS",
"license": "GPL-2.0-or-later",
"assets": [
{
"name": "plg_system_opengraph.opengraph-placeholder",
"type": "script",
"uri": "plg_system_opengraph/opengraph-placeholder.min.js",
"dependencies": [
"core"
],
"attributes": {
"type": "module"
}
}
]
}
Loading