Giter Site home page Giter Site logo

lonalore / metatag Goto Github PK

View Code? Open in Web Editor NEW
12.0 3.0 10.0 315 KB

e107 (v2) plugin - This plugin allows you to automatically provide structured metadata, aka "meta tags", about a website.

License: GNU General Public License v3.0

PHP 96.86% JavaScript 2.74% CSS 0.40%
e107 plugin seo meta metatags e107-plugin

metatag's Introduction

Metatag

Join the chat at https://gitter.im/lonalore/metatag

e107 (v2) plugin - This plugin allows you to automatically provide structured metadata, aka "meta tags", about a website.

Features

  • Supports a large number of commonly used meta tags, including the page title, description, etc, and for Facebook's Open Graph, Twitter Cards and Dublin Core.
  • Global settings to control meta tags on all pages.
  • Per entity to control default meta tags for all items of a certain type, e.g. all news (news list page), all pages (page list)
  • Ability to override default meta tags on each entity item, e.g. to override meta tags on an individual news item.
  • Extendable and flexible API to define new entities and tokens (see e_metatag.php addon file).
  • Supports tokens (generic placeholder substitutions).

Requirements

  • e107 (>= v2.3.2)

Questions about this project?

Please feel free to report any bug found. Pull requests, issues, and plugin recommendations are more than welcome!

Donate with PayPal

If you think this plugin is useful and saves you a lot of work, a lot of costs (PHP developers are expensive) and let you sleep much better, then donating a small amount would be very cool.

Paypal

Buy Me a Coffee

Hey dude! Help me out for a cup of coffee!

Buy Me a Coffee

Screenshot

Admin UI for default meta tag settings

"Metatag" tab on "Create news" form (with collapsed panels)

"Available tokens" popup

"Metatag" tab on "Create news" form (with opened panels)

metatag's People

Contributors

gitter-badger avatar lonalore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

metatag's Issues

problem with pagination

Download category can be paginated.
Default for url (canonical, og:url) is e_SELF

/**
 * Returns with the current URL.
 */
function metatag_global_token_site_current_page_url()
{
	return defset('e_SELF', '');
}

But each page have different url
for example (you got this url when you click on pagination under list)
/download/category/6/stuff-in-development/?order=id&sort=desc&view=3&from=6
is different that
/download/category/6/stuff-in-development/
but e_SELF returns /download/category/6/stuff-in-development/ for all pages.

e_REQUEST_URL would be probably a better idea

next problem with serialize

After new installation (deleting tables)
There is the database error:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'data' cannot be null
[PREPARE] => INSERT INTO e107jm_metatag_default (name,type,parent,data) VALUES (:name, :type, :parent, :data)

My guess is that it's because using serialize - database field can't be null in that case. Normally there would be for empty value saved with json_encode() some text, but e107 version is saving null data.

I run to this problem some days ago and discussed on gitter.

this is solution:

image

there is more, you can find it around that datetime in main room

404 issue with images

Hi, I noticed this with images (if they are missing)

you are caching
cid is f.e. site/e107_media/999/images/2019-06/preview_frontend_.png
and
entity type metatag_default
title page (meta tag valur) is "Error"

if I set redirection to the system not found page
cached URL is (at least it's only one, not one recored for each missing image)
/site/?route=system/error/404&type=routeError

Is this correct behaviour?
Thanks

enhancement - add contact page

At first - thank you for this plugin.

But I missing its features on contact page. There is not either default og::image tag. Or maybe I just doing something wrong.

Plugin Not Working

Installed today on e107 site and even though I have changed on Global and Front Page tags to be {site:name} only, it still doen't change the title bar. Still reads PageTitle - SiteName

Thanks

Question - about config_alter()

Just for confirmation. I can change only token and default keys. No Name and Tabs. Just to know what to else check.

EDIT: working for tabs

where to set e_PAGETITLE

Hi,
I want to use global setting for plugin I am working on (first option). I have set:
{site:current-page:title} | {site:name}

that value is from

	$page_name = defset('PAGE_NAME', '');
	return defset('e_PAGETITLE', $page_name);

I have set it in e_header.php of that plugin, I see filled <title> tag of page (probably core thing)
but this tag is not filled:

<meta content=" | sitename" name="title" />

Thanks

Question - about replace tokens

Hi, just from curiosity.
When you are replacing tokens (in the method preProcessMetaTags() and then replaceTokens() , you are going for each value through all tokens.
F.e. for {news:title} you are going through all news tokens , but you can find right token without loop.
After removing parentheses $value is the direct key of the token.
$string = substr($value, 1, -1); - result: news:title
$tokens = $config[$entity_type]['token'][$string]

I am just curious if I am right or I am missing something. With caching it's quick enough.

detect news list sometimes fails

It's because this test:

function metatag_entity_news_list_detect()
{
	$page = defset('e_PAGE', '');
	$query = defset('e_QUERY', '');

	if($page == 'news.php' && empty($query))
	{
		return true;
	}

	return false;
}

But values for news list are (query is not empty):

e_PAGE news.php
e_QUERY default.0.0  or e_QUERY default.0.6

Parse error: syntax error

I didn't install this plugin, I just got site where it's installed to install theme. And I got this message:

Parse error: syntax error, unexpected '[' in xxx/e107_plugins/metatag/includes/metatag.page.php on line 184

only on pages, homepage and news works

that line looks like this:
return $date->convert_date(['page']['page_datestamp'], 'short');

Question - just discussion

Hi, I am trying to find the solution on how to use your plugin without any code changes or without creating a new plugin for this.

What I am trying to do:
for
$config['download-category']
add new token if plugin is installed

'download:category:canonical' => array(
					'help'    => 'Canonical url',
					'handler' => 'metatag_entity_download_category_token_canurl',
					'file'    => '{e_PLUGIN}jmdownload/includes/metatag.canonical.php',
),

and change default

'default' => array(
'og:canonical'             => '{download:category:canonical}',
)

I have working solution with jmdownload plugin where I have my own browser of download categories with new event "jmdownload-category"

I could:

  1. to require with jmcanonical plugin to install jmdownload, but I dislike this. That plugin is the only solution for missing core functionality and it's planned to remove it during the time. It's a personal solution, it's not shared.

  2. I tried to add e_metatag and e_event and tokens to jmcanonical plugin, but it was ignored. Or I did it the wrong way.
    Is possible override/change settings for e_metatag with another plugin? I think it depends on the order of loading addons. the metatag is after jmcanonical and so it's config is used.

Any ideas? Thanks

warning error with metatag admin_ui

Just report, there were changes in core I think.

Declaration of metatag_admin_ui::beforeUpdate($new_data, $old_data) should be compatible with e_admin_ui::beforeUpdate($new_data, $old_data, $id), Line 218 of G:\php72\htdocs\***\e107_plugins\metatag\admin_config.php

problem with unserialize

I know you are working on it, but there was similar problem before, so maybe this is related to core.

Installed latest version, run update to 1.6.

e107inc/e107#3693

image

#0  e_array->unserialize() called at [***\e107_handlers\e107_class.php:1791]
#1  e107::unserialize() called at [***\e107_plugins\metatag\includes\metatag.class.php:2957]
#2  metatag->getDefaultMetaTagsByType() called at [***\e107_plugins\metatag\includes\metatag.class.php:2865]

$data:

$data = array (
  &#039;title&#039; => &#039;&#039;,
  &#039;description&#039; => &#039;&#039;,
  &#039;abstract&#039; => &#039;&#039;,
  &#039;keywords&#039; => &#039;&#039;,
  &#039;news_keywords&#039; => &#039;&#039;,
  &#039;standout&#039; => &#039;&#039;,
  &#039;rating&#039; => &#039;&#039;,
  &#039;referrer&#039; => &#039;&#039;,
  &#039;generator&#039; => &#039;&#039;,
  &#039;rights&#039; => &#039;&#039;,
  &#039;image_src&#039; => &#039;&#039;,
  &#039;canonical&#039; => &#039;&#039;,
  &#039;shortlink&#039; => &#039;&#039;,
  &#039;publisher&#039; => &#039;&#039;,
  &#039;author&#039; => &#039;&#039;,
  &#039;original-source&#039; => &#039;&#039;,
  &#039;prev&#039; => &#039;&#039;,
  &#039;next&#039; => &#039;&#039;,
  &#039;geo.position&#039; => &#039;&#039;,
  &#039;geo.placename&#039; => &#039;&#039;,
  &#039;geo.region&#039; => &#039;&#039;,
  &#039;icbm&#039; => &#039;&#039;,
  &#039;refresh&#039; => &#039;&#039;,
  &#039;og:site_name&#039; => &#039;&#039;,
  &#039;og:type&#039; => &#039;&#039;,
  &#039;og:url&#039; => &#039;&#039;,
  &#039;og:title&#039; => &#039;&#039;,
  &#039;og:determiner&#039; => &#039;&#039;,
  &#039;og:description&#039; => &#039;&#039;,
  &#039;og:updated_time&#039; => &#039;&#039;,
  &#039;og:see_also&#039; => &#039;&#039;,
  &#039;og:image&#039; => &#039;&#039;,
  &#039;og:image:url&#039; => &#039;&#039;,
  &#039;og:image:secure_url&#039; => &#039;&#039;,
  &#039;og:image:type&#039; => &#039;&#039;,
  &#039;og:image:width&#039; => &#039;&#039;,
  &#039;og:image:height&#039; => &#039;&#039;,
  &#039;og:latitude&#039; => &#039;&#039;,
  &#039;og:longitude&#039; => &#039;&#039;,
  &#039;og:street_address&#039; => &#039;&#039;,
  &#039;og:locality&#039; => &#039;&#039;,
  &#039;og:region&#039; => &#039;&#039;,
  &#039;og:postal_code&#039; => &#039;&#039;,
  &#039;og:country_name&#039; => &#039;&#039;,
  &#039;og:email&#039; => &#039;&#039;,
  &#039;og:phone_number&#039; => &#039;&#039;,
  &#039;og:fax_number&#039; => &#039;&#039;,
  &#039;og:locale&#039; => &#039;&#039;,
  &#039;og:locale:alternate&#039; => &#039;&#039;,
  &#039;article:author&#039; => &#039;&#039;,
  &#039;article:publisher&#039; => &#039;&#039;,
  &#039;article:section&#039; => &#039;&#039;,
  &#039;article:tag&#039; => &#039;&#039;,
  &#039;article:published_time&#039; => &#039;&#039;,
  &#039;article:modified_time&#039; => &#039;&#039;,
  &#039;article:expiration_time&#039; => &#039;&#039;,
  &#039;profile:first_name&#039; => &#039;&#039;,
  &#039;profile:last_name&#039; => &#039;&#039;,
  &#039;profile:username&#039; => &#039;admin&#039;,
  &#039;profile:gender&#039; => &#039;&#039;,
  &#039;og:audio&#039; => &#039;&#039;,
  &#039;og:audio:secure_url&#039; => &#039;&#039;,
  &#039;og:audio:type&#039; => &#039;&#039;,
  &#039;book:author&#039; => &#039;&#039;,
  &#039;book:isbn&#039; => &#039;&#039;,
  &#039;book:release_date&#039; => &#039;&#039;,
  &#039;book:tag&#039; => &#039;&#039;,
  &#039;og:video:url&#039; => &#039;&#039;,
  &#039;og:video:secure_url&#039; => &#039;&#039;,
  &#039;og:video:width&#039; => &#039;&#039;,
  &#039;og:video:height&#039; => &#039;&#039;,
  &#039;og:video:type&#039; => &#039;&#039;,
  &#039;video:actor&#039; => &#039;&#039;,
  &#039;video:actor:role&#039; => &#039;&#039;,
  &#039;video:director&#039; => &#039;&#039;,
  &#039;video:writer&#039; => &#039;&#039;,
  &#039;video:duration&#039; => &#039;&#039;,
  &#039;video:release_date&#039; => &#039;&#039;,
  &#039;video:tag&#039; => &#039;&#039;,
  &#039;video:series&#039; => &#039;&#039;,
  &#039;fb:admins&#039; => &#039;&#039;,
  &#039;fb:app_id&#039; => &#039;&#039;,
  &#039;twitter:card&#039; => &#039;&#039;,
  &#039;twitter:site:id&#039; => &#039;&#039;,
  &#039;twitter:creator&#039; => &#039;&#039;,
  &#039;twitter:creator:id&#039; => &#039;&#039;,
  &#039;twitter:url&#039; => &#039;&#039;,
  &#039;twitter:title&#039; => &#039;&#039;,
  &#039;twitter:description&#039; => &#039;&#039;,
  &#039;twitter:image&#039; => &#039;&#039;,
  &#039;twitter:image:width&#039; => &#039;&#039;,
  &#039;twitter:image:height&#039; => &#039;&#039;,
  &#039;twitter:image:alt&#039; => &#039;&#039;,
  &#039;twitter:image0&#039; => &#039;&#039;,
  &#039;twitter:image1&#039; => &#039;&#039;,
  &#039;twitter:image2&#039; => &#039;&#039;,
  &#039;twitter:image3&#039; => &#039;&#039;,
  &#039;twitter:player&#039; => &#039;&#039;,
  &#039;twitter:player:width&#039; => &#039;&#039;,
  &#039;twitter:player:height&#039; => &#039;&#039;,
  &#039;twitter:player:stream&#039; => &#039;&#039;,
  &#039;twitter:player:stream:content_type&#039; => &#039;&#039;,
  &#039;twitter:app:country&#039; => &#039;&#039;,
  &#039;twitter:app:name:iphone&#039; => &#039;&#039;,
  &#039;twitter:app:id:iphone&#039; => &#039;&#039;,
  &#039;twitter:app:url:iphone&#039; => &#039;&#039;,
  &#039;twitter:app:name:ipad&#039; => &#039;&#039;,
  &#039;twitter:app:id:ipad&#039; => &#039;&#039;,
  &#039;twitter:app:url:ipad&#039; => &#039;&#039;,
  &#039;twitter:app:name:googleplay&#039; => &#039;&#039;,
  &#039;twitter:app:id:googleplay&#039; => &#039;&#039;,
  &#039;twitter:app:url:googleplay&#039; => &#039;&#039;,
  &#039;twitter:label1&#039; => &#039;&#039;,
  &#039;twitter:data1&#039; => &#039;&#039;,
  &#039;twitter:label2&#039; => &#039;&#039;,
  &#039;twitter:data2&#039; => &#039;&#039;,
  &#039;dcterms.title&#039; => &#039;&#039;,
  &#039;dcterms.creator&#039; => &#039;&#039;,
  &#039;dcterms.subject&#039; => &#039;&#039;,
  &#039;dcterms.description&#039; => &#039;&#039;,
  &#039;dcterms.publisher&#039; => &#039;&#039;,
  &#039;dcterms.contributor&#039; => &#039;&#039;,
  &#039;dcterms.date&#039; => &#039;&#039;,
  &#039;dcterms.type&#039; => &#039;&#039;,
  &#039;dcterms.format&#039; => &#039;&#039;,
  &#039;dcterms.identifier&#039; => &#039;&#039;,
  &#039;dcterms.source&#039; => &#039;&#039;,
  &#039;dcterms.language&#039; => &#039;&#039;,
  &#039;dcterms.relation&#039; => &#039;&#039;,
  &#039;dcterms.coverage&#039; => &#039;&#039;,
  &#039;dcterms.rights&#039; => &#039;&#039;,
  &#039;itemprop:name&#039; => &#039;&#039;,
  &#039;itemprop:description&#039; => &#039;&#039;,
  &#039;itemprop:image&#039; => &#039;&#039;,
);

PATH: /e107_plugins/download/admin_download.php?mode=main&action=list

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.