Jump to content
Nico Knoll

MarkupSEO - The all-in-one SEO solution for ProcessWire.

Recommended Posts

@mike: 

Thanks for adding it. I'll take a look.

@ceberlin:

Select a custom field with a fallback to title?

You can use multiple smart titles. So the first one will be used if filled (https://github.com/NicoKnoll/MarkupSEO/blob/master/MarkupSEO.module#L182-L187). If not the second one is used and so on. "Smart title" will be used in case you leave the "Title" field in the SEO tab empty.

post-140-0-92619200-1422108590_thumb.png

Canonical

Yes it's $page->httpUrl by default (https://github.com/NicoKnoll/MarkupSEO/blob/master/MarkupSEO.module#L233). But you're right. I should add a comment.

URL Segments

I'm not sure either how to handle them. But as they are not "real" pages I guess this module isn't able to handle them anyway (you can't add SEO fields to non existing pages...)

link rel="alternate" hreflang

I'll add an option to include this :)

  • Like 1

Share this post


Link to post
Share on other sites

Hi Nico,

Thanks for this module! Love it much :)

I think I may have found a conflicting issue when this module is installed along side with ProcessBackup (DB Backup module). There is an error when you try to view the Database Backup detail and I believe it may be caused by the following line:

$editedPage = wire('pages')->get($this->config->input->get->id);

The SEO module kicks in when trying to view the database backup page because there is a querystring id in the url.

setup/db-backups/info/?id=0:dev.cc26012015-01.sql

The fix is pretty simple:

    public function ready() {
      // backend hooks
      if(@$this->page->process == 'ProcessPageEdit') {
        $editedPage = wire('pages')->get($this->config->input->get->id);

        if(in_array($editedPage->template->name, $this->includeTemplates)) {
          $this->addHookAfter("ProcessPageEdit::buildFormContent", $this, 'hookCustomizeSeoTab');
        }
      }

      // frontend hooks
      if($this->page->template != 'admin' && in_array($this->page->template->name, $this->includeTemplates)) {
        $this->addHookProperty("Page::seo", $this, 'hookFrontendPage');
        $this->addHookProperty("Config::seo", $this, 'hookFrontendConfig');
      }
    }

Check the ProcessEditPage first before look for the edited page object. But anyway, I thought I let you know :) Thanks much again!

  • Like 3

Share this post


Link to post
Share on other sites

Hi Nico,

>Canonical

>Yes it's $page->httpUrl

I see a potential double content problem here:

A page can exist in http and in https mode. Especially after a https page was called (admin area, or a form in the frontend for example) a user stays in https mode until a next page which is set as http-only was opened.

Do you agree that a double content issue is possible?

If so, my idea would be using this checking order:

1. is the whole site https only (the brand new setting option in the latest dev) ->https

2. fallback: is there a strict setting in the URL part of the template for https? ->https

3. fallback: use the common way to display a website ->http

What Do you think?

Share this post


Link to post
Share on other sites

If so, my idea would be using this checking order:

1. is the whole site https only (the brand new setting option in the latest dev) ->https

2. fallback: is there a strict setting in the URL part of the template for https? ->https

3. fallback: use the common way to display a website ->http

I would support such a process, as google is suggesting webmasters to use https. I don't know for sure about the state of improved rankings from https, but as it's a possible factor, it should be taken care of as best as possible.

Share this post


Link to post
Share on other sites

Hallo,

till today I used version 0.3.0.

Now I have deleted this and replaced it with 0.6.0. Since this I miss the SEO-tab.

What makes the SEO-tab apear again?

Share this post


Link to post
Share on other sites

@makari: You now have to define which templates should get a SEO-tab in the module's settings :)

Share this post


Link to post
Share on other sites

URL Segments

I'm not sure either how to handle them. But as they are not "real" pages I guess this module isn't able to handle them anyway (you can't add SEO fields to non existing pages...)

Personally I'm not using the SEO module, I set it up in my _init.php, and when using URL Segments I add it in my templates.

Correct me if I'm wrong, but using URLSegments you actually have to edit the template, since it's not an actual page and doesn't have a title and/or meta_descriptions can't you create some default fall-back when URL Segments are used?

Then in the template itself:

SeoModule->fallback_string(__('%1$s is part of %2$s and contains %3$s subpages'),$URLSegment1, $page->parent->title, count($page->children));

or as matter as fact any default outcome when a $page->name/$page->core.title doesn't exist at all...?

BTW above "code" is just fiction, but I guess you know where I'm going...

Now we're at it, URL Segments aren't included in the current sitmap xml module either, which is not ideal on a SEO point of view.

Share this post


Link to post
Share on other sites

@makari: You now have to define which templates should get a SEO-tab in the module's settings :)

I did it. But no SEO-tab anywere... :mellow:

I guess, some of the old versions data is left in the database - but how can I find that - and where?

Share this post


Link to post
Share on other sites

@makari: If you want me to take look at it just write me a PM with login information (you could create a tmp user account for me or so if you're not working locally :))

Share this post


Link to post
Share on other sites

Version 0.7.0:

Hey, I added the https option you asked for:

post-140-0-95031700-1422794809_thumb.png

$config->https will be set to true in runtime I guess if the template is set to use https, too. So all of the fallbacks should be covered.

And I added the fix by @peterfoeng.

  • Like 1

Share this post


Link to post
Share on other sites

I'm not getting an SEO tab appear on my publish/edit pages. I'm also not seeing any seo_xxxx fields in my fields list. So I thought I should maybe uninstall and reinstall, but when I try to uninstall I get:

Recoverable Fatal Error: Argument 1 passed to Fields::___delete() must implement interface Saveable, null given (line 265 of /wire/core/Fields.php) 
This error message was shown because you are logged in as a Superuser. Error has been logged.

And yes, I have specified templates to get the tab in the module's settings.

Share this post


Link to post
Share on other sites

Thanks for this module.

I use smart fields and got a little bit trouble using the description field. Because I chose fields which include html tags. Even if if I check "Strip Tags" in the field settings for seo_description. I guess that this setting doesn't take effect if the field was left blank. This results in:

<meta name="og:description" content="<h2>KF Interactive GmbH</h2>
	
	<p>
	D-04107 Leipzig</p>
	
	<p>Tel.: +<br />
	Fax: +<br />
	Mail: <a href=" mailto:info@kf-interactive.com"="">
<p><strong>Konzeption und Gestaltung der Website:</strong><br>
	<a href=""></a> & KF Interactive</p>
">
	

.. and breaks the layout.

I changed line 206:

-             $pageData['description'] = $page->get(implode('|', $configData['descriptionSmart']));
+             $pageData['description'] = strip_tags($page->get(implode('|', $configData['descriptionSmart']))); 

.. and everything works  :)

Maybe you could include this litte fix in a later version?

  • Like 4

Share this post


Link to post
Share on other sites

Regarding the HTTPS option:

$pageData['canonical'] = preg_replace('%^http%Uis', 'https', $page->httpUrl);

should be

$pageData['canonical'] = preg_replace('%^https?%i', 'https', $page->httpUrl);

This way the regex will capture all of the protocol string regardless of whether it is http or https at this stage. In my case I got a httpss in the resulting links from the first one as it matched the http, when the input was https.

Tried a few other regexes (e.g. https?, etc.) as well which logically should've worked, but preg_replace in its true self proved to be inconsistent.

Scratch that - read over the U modifier.

Fix returns https for both http and https as input, so covers both eventualities in the context of where it's called in the codebase.

  • Like 1

Share this post


Link to post
Share on other sites

Had to add a character counter with limiting functionality for one of my projects. Take a look and let me know what you think for now https://github.com/pjguk/MarkupSEO

No guarantees given - this was "hacked" straight into a production environment which already utilises the module and therefore uninstalling and reinstalling was not an option for the time being.

Particulars that are most likely not working as expected for now (Couldn't reliably test yet):

  • Default character limits are not set on install
  • Default character limits do not set should the limit field be empty when the page is saved
  • Hard character limits do not apply to pages unless the fields are being edited and the page subsequently saved (requirement for my project, may not be the behaviour everybody wants/needs)

So still some teething problems with the config on that part, but works well enough for me for the time being.

The modifications allow the following:

post-1687-0-78764400-1423414963_thumb.pn

Counter added to the title and description fields in the SEO tab. Counting down from the limit to 0 - and beyond to show how many characters you are over.

post-1687-0-54384900-1423414472_thumb.pn

Config options in the module settings to set the character limits for title and description as well as toggling hard limits. Hard limits disable the ability to enter more than the limit number of characters. Useful if multiple authors work with the SEO tabs and you want to ensure nobody goes over the limits.

post-1687-0-89385900-1423414964_thumb.pn

With hard limiting disabled the character counter simply goes into the negative and ignores the limit for the actual input and render.

post-1687-0-36572600-1423414966_thumb.pn

With hard limiting enabled the input cuts off at 0 characters left.

  • Like 1

Share this post


Link to post
Share on other sites

@pjg: Hey, I implemented the counter you suggested. It's a little bit different from your version but it has the same settings :)

  • Like 1

Share this post


Link to post
Share on other sites

@pjg: Hey, I implemented the counter you suggested. It's a little bit different from your version but it has the same settings :)

Very nice implementation. Works a charm.

  • Like 1

Share this post


Link to post
Share on other sites

I've posted here and created an issue on Github but not received a reply to either. If my question is lacking some information, please let me know.

  • Like 2

Share this post


Link to post
Share on other sites

@tyssen: if you can't delete it go to fields and delete all of the (remaining) seo fields manually. Then go to the modules code and delete the whole ___delete() function. Then uninstall the module and delete the .module file. Then download the most recent version (0.8.1), install it and let me now if it works better afterwards :)

Share this post


Link to post
Share on other sites

This module cause a conflict with pages on the front end that use the id variable.

"../json_pages/?id=234|434"  will crash processwire. 

this seems to be the caused by: LINE: 92.

$editedPage = wire('pages')->get($this->config->input->get->id)

I think checking that you are in the backend before running the above query might solve the issue.

btw, great plugin. 

  • Like 1

Share this post


Link to post
Share on other sites

All good now, thanks. And very nice module, previewing feature especially.

Just one small request: it would be useful to have a way to override the Title Format on certain pages, e.g. the home page. For most pages I'll want to have Page Name – Site Name, but on the home page I'll want to have Site Name – Site Description, but with title format enabled I get Site Name – Site Description – Site Name.

  • Like 1

Share this post


Link to post
Share on other sites

@Neeks: Which version of the module you're using? In the latest version there is a check if it is "ProcessPageEdit".

@Tyssen: Glad to here it's now working for you :) I may integrate that :)

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for adding strip_tags for smart fields  :)

I got a little bit of trouble regarding the new piwik including. Still after re-saving the module settings I get the following error:

Notice: Undefined index: piwikAnalyticsUrl in /.../public/site/modules/MarkupSEO/MarkupSEO.module on line 311

On line 311 you need to check first if this array key exists because in the database there is just an entry for "piwikAnalytics":"" initially. As a quick fix I added ,"piwikAnalyticsUrl":"" manually.

Changing line 311 to

if (array_key_exists('piwikAnalyticsUrl', $configData) && $configData['piwikAnalyticsUrl']) 

or  check if piwikAnalytics is not empty

if (!empty($configData['piwikAnalytics']) && $configData['piwikAnalyticsUrl'])

should solve this issue.

Share this post


Link to post
Share on other sites

Which version of the module are you using? In the most recent 0.8.1 this should be fixed already...

Edit: found the error and fixed it in 0.8.2. But it was on line 767 :)

Share this post


Link to post
Share on other sites

You corrected the names and therefore an empty entry will be saved. That's on line 767  ;) So you don't have to extend the if condition I suggested (on line 311) because you know that there is always an entry with this key.  ;) Thanks for the quick fix.

(I've been waiting for the strip_tags fix to be able to reset my deployment script because your module is included as a git submodule and I didn't want to change this. So I was quite sure to use the latest master version.)

Share this post


Link to post
Share on other sites

@justb3a: Yeah, you probably had the latest version. I found the bug you mentioned in 0.8.1 and released 0.8.2 like 10min ago after your post :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By MoritzLost
      This is a new module that provides a simple solution to clearing all your cache layers at once, and an extensible interface to perform various cache-related actions.
      The simple motivation behind this module was that I was tired of manually clearing caches in several places after deploying a change on a live site. The basic purpose of this module is a simple Clear all caches link in the Setup menu which clears out all caches, no matter where they hide. You can customize what exactly the module does through it's configuration menu:
      Expire or delete all cache entries in the database, or selectively clear caches by namespace ($cache API) Clear the the template render cache. Clear out specific folders inside your site's cache directory (/site/assets/cache) Refresh version strings for static assets to bust client-side browser caches (this requires some setup, see the full documentation for details). This is the basic function of the module. However, you can also add different cache management action through the API and execute them through the module's interface. For this advanced usage, the module provides:
      An interface to see all available cache actions and execute them. A system log and logging output on the module page to see verify what the module is doing. A CacheControlTools class with utility functions to clear out different caches. An API to add cache actions, execute them programmatically and even modify the default action. Permission management, allowing you granular control over which user roles can execute which actions. The complete documentation can be found in the module's README.
      Beta release
      Note that I consider this a Beta release. Since the module is relatively aggressive in deleting some caches, I would advise you to install in on a test environment before using it on a live site.
      Let me know if you're getting any errors, have trouble using the module or if you have suggestions for improvement!
      In particular, can someone let me know if this module causes any problems with the ProCache module? I don't own or use it, so I can't check. As far as I can tell, ProCache uses a folder inside the cache directory to cache static pages, so my module should be able to clear the ProCache site cache as well, I'd appreciate it if someone can test that for me.
      Future plans
      If there is some interest in this, I plan to expand this to a more general cache management solution. I particular, I would like to add additional cache actions. Some ideas that came to mind:
      Warming up the template render cache for publicly accessible pages. Removing all active user sessions. Let me know if you have more suggestions!
      Links
      https://github.com/MoritzLost/ProcessCacheControl ProcessCacheControl in the Module directory

    • By joshua
      This module is (yet another) way for implementing a cookie management solution.
      Of course there are several other possibilities:
      - https://processwire.com/talk/topic/22920-klaro-cookie-consent-manager/
      - https://github.com/webmanufaktur/CookieManagementBanner
      - https://github.com/johannesdachsel/cookiemonster
      - https://www.oiljs.org/
      - ... and so on ...
      In this module you can configure which kind of cookie categories you want to manage:

      You can also enable the support for respecting the Do-Not-Track (DNT) header to don't annoy users, who already decided for all their browsing experience.
      Currently there are four possible cookie groups:
      - Necessary (always enabled)
      - Statistics
      - Marketing
      - External Media
      All groups can be renamed, so feel free to use other cookie group names. I just haven't found a way to implement a "repeater like" field as configurable module field ...
      When you want to load specific scripts ( like Google Analytics, Google Maps, ...) only after the user's content to this specific category of cookies, just use the following script syntax:
      <script type="optin" data-type="text/javascript" data-category="statistics" data-src="/path/to/your/statistic/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing" data-src="/path/to/your/mareketing/script.js"></script> <script type="optin" data-type="text/javascript" data-category="external_media" data-src="/path/to/your/external-media/script.js"></script> <script type="optin" data-type="text/javascript" data-category="marketing">console.log("Inline scripts are also working!");</script> The type has to be "optin" to get recognized by PrivacyWire, the data-attributes are giving hints, how the script shall be loaded, if the data-category is within the cookie consents of the user. These scripts are loaded asynchronously after the user made the decision.
      If you want to give the users the possibility to change their consent, you can use the following Textformatter:
      [[privacywire-choose-cookies]] It's planned to add also other Textformatters to opt-out of specific cookie groups or delete the whole consent cookie.
      You can also add a custom link to output the banner again with a link / button with following class:
      <a href="#" class="privacywire-show-options">Show Cookie Options</a> <button class="privacywire-show-options">Show Cookie Options</button> This module is still in development, but we already use it on several production websites.
      You find it here: https://github.com/blaueQuelle/privacywire/tree/master
      Download: https://github.com/blaueQuelle/privacywire/archive/master.zip
      I would love to hear your feedback 🙂
      Edit: Updated URLs to master tree of git repo
       
    • By David Karich
      Admin Page Tree Multiple Sorting
      ClassName: ProcessPageListMultipleSorting
      Extend the ordinary sort of children of a template in the admin page tree with multiple properties. For each template, you can define your own rule. Write each template (template-name) in a row, followed by a colon and then the additional field names for sorting.
      Example: All children of the template "blog" to be sorted in descending order according to the date of creation, then descending by modification date, and then by title. Type:
      blog: -created, -modified, title  Installation
      Copy the files for this module to /site/modules/ProcessPageListMultipleSorting/ In admin: Modules > Check for new modules. Install Module "Admin Page Tree Multible Sorting". Alternative in ProcessWire 2.4+
      Login to ProcessWire backend and go to Modules Click tab "New" and enter Module Class Name: "ProcessPageListMultipleSorting" Click "Download and Install"   Compatibility   I have currently tested the module only under PW 2.6+, but think that it works on older versions too. Maybe someone can give a feedback.     Download   PW-Repo: http://modules.processwire.com/modules/process-page-list-multiple-sorting/ GitHub: https://github.com/FlipZoomMedia/Processwire-ProcessPageListMultipleSorting     I hope someone can use the module. Have fun and best regards, David
    • By dimitrios
      Hello,
      this module can publish content of a Processwire page on a Facebook page, triggered by saving the Processwire page.
      To set it up, configure the module with a Facebook app ID, secret and a Page ID. Following is additional configuration on Facebook for developers:
      Minimum Required Facebook App configuration:
      on Settings -> Basics, provide the App Domains, provide the Site URL, on Settings -> Advanced, set the API version (has been tested up to v3.3), add Product: Facebook Login, on Facebook Login -> Settings, set Client OAuth Login: Yes, set Web OAuth Login: Yes, set Enforce HTTPS: Yes, add "https://www.example.com/processwire/page/" to field Valid OAuth Redirect URIs. This module is configurable as follows:
      Templates: posts can take place only for pages with the defined templates. On/Off switch: specify a checkbox field that will not allow the post if checked. Specify a message and/or an image for the post.
      Usage
      edit the desired PW page and save; it will post right after the initial Facebook log in and permission granting. After that, an access token is kept.
       
      Download
      PW module directory: http://modules.processwire.com/modules/auto-fb-post/ Github: https://github.com/kastrind/AutoFbPost   Note: Facebook SDK for PHP is utilized.


×
×
  • Create New...