Coder Social home page Coder Social logo

isobar-nz / silverstripe-seo-editor Goto Github PK

View Code? Open in Web Editor NEW
13.0 13.0 7.0 163 KB

SEO Editor Administration for SilverStripe

License: MIT License

PHP 89.86% CSS 4.37% JavaScript 5.77%
cms-extension php silverstripe silverstripe-seo-editor

silverstripe-seo-editor's People

Contributors

axllent avatar stevie-mayhew avatar thebnl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

silverstripe-seo-editor's Issues

Not working with Fluent

The handleAction function does a direct UPDATE on the database to gain speed:

DB::query("UPDATE SiteTree SET {$fieldName} = '{$sqlValue}' WHERE ID = {$page->ID}");
if ($page->isPublished()) {
     DB::query("UPDATE SiteTree_Live SET {$fieldName} = '{$sqlValue}' WHERE ID = {$page->ID}");
}

This causes other modules like Fluent to work incorrectly.
If you change this to the ORM method:

$page->$fieldName = $sqlValue;
$page->write();
if ($page->isPublished()) {
      $page->doPublish();
}

I made a fork with a new branch called enable-augmentation, with this implemented:
https://github.com/RVXD/silverstripe-seo-editor/tree/enable-augmentation

Perhaps if you would want the increased speed for sites without Fluent, this could be made optional.

Translatable query string conflict

Ran into a small issue today on a site using Translatable.

Translatable adds a query string which is visible in the url attribute of a gridfield fieldset. This proves problematic as this module appends to the url attribute value and we end up with an ajax post request like
"admin/seo-editor/SiteTree/EditForm/field/SiteTree?Locale=en_NZ/update/1" which results in a bad request.

To get around it quickly i've just made an extension and included a tweaked javascript file where it deals with the creating the request url.

var url = $this.closest('.ss-gridfield').attr('data-url');
if(url.indexOf('?Locale=') != -1) {
    url = url.replace('?Locale=', '/update/' + id + '?Locale=');
} else {
    url = url + "/update/" + id;
}

Was done in a bit of rush so i'm sure there's a nicer way of dealing with this. Feel free to close if it's considered something not worth worrying about.

open graph support

this would be awesome to integrate with tractorcow/silverstripe-opengraph and be able to override opengraph on all pages

CSV import issue

Great module. I am experiencing an issue importing a CSV file - get "Nothing to import" message after importing.

Idea: recognise default values

Hey @stevie-mayhew, what's up ๐Ÿ˜€

Just trying this module, it looks handy. I was thinking though, that in real world use (for me at least) all my pages have a meta title whether I provide a custom one or not, because I'll generate one if not provided. I'll sometimes do the same for Meta Descriptions too. So I would like error messages to reflect the actual tags that are output, and I would like to see the default content when a field is blank, to know whether it's worth overriding it with a custom value.

What do you think about providing a method like this to determine a default value:

// Provide a default meta title if no custom one is set
public function defaultMetaTitle() {
    return $this->Title . ' โ†’ ' . SiteConfig::current_site_config()->Title;
}

This could be overridden in the Page class to let developers define their own default. Then you could set a placeholder on form fields so that any blank fields display their default values, and show error messages based on the final resolved value rather than the custom value only.

To explain my approach further - to bring this all together I would then put something like this in my Page class:

// Resolve the actual meta title content that will be output
public function resolvedMetaTitle() {
    return $this->MetaTitle ?: $this->defaultMetaTitle();
}

And I'd put this in my PageController. (Putting it on the model would cause the resolved value to be populated on MetaTitle form fields)

// Resolve a meta title for this page
public function getMetaTitle() {
    return $this->resolvedMetaTitle();
}

Invalid SQL query when a site has only one page

When trying to access the SEO editor for a site with only one page, SeoEditorAdmin#markDuplicates generates a filter that leads to an invalid SQL query:

SELECT DISTINCT "SiteTree_Live"."ClassName", "SiteTree_Live"."Created",
"SiteTree_Live"."LastEdited", "SiteTree_Live"."URLSegment", "SiteTree_Live"."Title", 
"SiteTree_Live"."MenuTitle", "SiteTree_Live"."Content", "SiteTree_Live"."MetaDescription", 
"SiteTree_Live"."ExtraMeta", "SiteTree_Live"."ShowInMenus", "SiteTree_Live"."ShowInSearch", 
"SiteTree_Live"."Sort", "SiteTree_Live"."HasBrokenFile", "SiteTree_Live"."HasBrokenLink", 
"SiteTree_Live"."ReportClass", "SiteTree_Live"."CanViewType", "SiteTree_Live"."CanEditType", 
"SiteTree_Live"."Priority", "SiteTree_Live"."MetaTitle", "SiteTree_Live"."Version", 
"SiteTree_Live"."ParentID", "SiteTree_Live"."ID", CASE WHEN "SiteTree_Live"."ClassName" 
IS NOT NULL
THEN "SiteTree_Live"."ClassName" ELSE 'SiteTree' END AS "RecordClassName"
FROM "SiteTree_Live" WHERE ("SiteTree_Live"."ID" IN ('')) ORDER BY "SiteTree_Live"."Sort" ASC

Specifically WHERE ("SiteTree_Live"."ID" IN ('')) uses an empty string when it should be a list of integers.

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.