You are here

README.txt in SEO Compliance Checker 6

---------------------------------------------------------------------------
seo_checker - Version 1.0
---------------------------------------------------------------------------
Author: Michael Ruoss (mruoss at optaros dot co m)

Overview:
=========
The SEO Compliance Checker hooks into the node creation and modification 
procedure and checks the submitted content on the compliance of specific 
search engine optimization rules.

seo_checker is the core module that triggers the checks and displays 
their results. The checks for the several SEO rules have to be provided by
separate submodules.

The core module comes along with such a submodule providing checks for some 
basic SEO rules. There is however a simple way to extend the functionality
of the checker by adding more such rules in further submodules.

Installation:
=============
Please have a look at INSTALL.txt

Defining further SEO rules:
===========================
A submodule providing rules for the seo_checker should implement the hook
hook_register_seo_rules() which should return an array providing the most
important informations about the rules which are the following:

  name:                 The name of the rule
  description:          Describes what the rule checks upon
  threshold type:       There are currently two possible types:
                          at_least: The result of the check must reach a 
                                    certain threashold in order to succeed
                          range:    The result must be inside a range 
                                    (e.g. between 20% and 40%)
  default threshold:    Thresholds can be changed on the settings page. 
                        Here you can set a default. use array(20,40) for
                        ranges. 
  callback:             This is the function that implements the check. 
                        It will be called by seo_checker.
  passed feedback:      The feedback the user gets if he passes the check
  failed feedback:      The feedback the user gets if he failed the check


An example for an implementation of this hook:

basic_seo_rules_register_seo_rules() {
  $rules['alt_attributes'] = array(
    'name' => t('Alt attributes in <img> - tags'),
    'description' => t('Checks if all the <img> tags have an alt attribute.'),
    'threshold type' => 'at_least',
    'default threshold' => 100,
    'callback' => 'basic_seo_rules_alt_attribute',
    'passed feedback' => t('Test passed.'),
    'failed feedback' => t('Test failed, please make sure your images contain an alternative text.'), 
  );
return $rules;
}


Implementing the checks:
========================
For the example displayed above we would now implement the
function basic_seo_rules_alt_attribute($form_values) which will be called by
the SEO Checker, passing it the values from the node_form.

As the checker displays percents, the function should return a value between
0 and 100.


Adding a settings tab for your rules:
=====================================
Using hook_menu you can add your own tabs in the default setting page of the
SEO Checker. Just use the same path and the type MENU_LOCAL_TASK:

$items['admin/settings/seo_checker/YOUR_MODULE'] = array( 
 'title' => ...
 ... => ...
 'type' => MENU_LOCAL_TASK,
)

File

README.txt
View source
  1. ---------------------------------------------------------------------------
  2. seo_checker - Version 1.0
  3. ---------------------------------------------------------------------------
  4. Author: Michael Ruoss (mruoss at optaros dot co m)
  5. Overview:
  6. =========
  7. The SEO Compliance Checker hooks into the node creation and modification
  8. procedure and checks the submitted content on the compliance of specific
  9. search engine optimization rules.
  10. seo_checker is the core module that triggers the checks and displays
  11. their results. The checks for the several SEO rules have to be provided by
  12. separate submodules.
  13. The core module comes along with such a submodule providing checks for some
  14. basic SEO rules. There is however a simple way to extend the functionality
  15. of the checker by adding more such rules in further submodules.
  16. Installation:
  17. =============
  18. Please have a look at INSTALL.txt
  19. Defining further SEO rules:
  20. ===========================
  21. A submodule providing rules for the seo_checker should implement the hook
  22. hook_register_seo_rules() which should return an array providing the most
  23. important informations about the rules which are the following:
  24. name: The name of the rule
  25. description: Describes what the rule checks upon
  26. threshold type: There are currently two possible types:
  27. at_least: The result of the check must reach a
  28. certain threashold in order to succeed
  29. range: The result must be inside a range
  30. (e.g. between 20% and 40%)
  31. default threshold: Thresholds can be changed on the settings page.
  32. Here you can set a default. use array(20,40) for
  33. ranges.
  34. callback: This is the function that implements the check.
  35. It will be called by seo_checker.
  36. passed feedback: The feedback the user gets if he passes the check
  37. failed feedback: The feedback the user gets if he failed the check
  38. An example for an implementation of this hook:
  39. basic_seo_rules_register_seo_rules() {
  40. $rules['alt_attributes'] = array(
  41. 'name' => t('Alt attributes in <img> - tags'),
  42. 'description' => t('Checks if all the tags have an alt attribute.'),
  43. 'threshold type' => 'at_least',
  44. 'default threshold' => 100,
  45. 'callback' => 'basic_seo_rules_alt_attribute',
  46. 'passed feedback' => t('Test passed.'),
  47. 'failed feedback' => t('Test failed, please make sure your images contain an alternative text.'),
  48. );
  49. return $rules;
  50. }
  51. Implementing the checks:
  52. ========================
  53. For the example displayed above we would now implement the
  54. function basic_seo_rules_alt_attribute($form_values) which will be called by
  55. the SEO Checker, passing it the values from the node_form.
  56. As the checker displays percents, the function should return a value between
  57. 0 and 100.
  58. Adding a settings tab for your rules:
  59. =====================================
  60. Using hook_menu you can add your own tabs in the default setting page of the
  61. SEO Checker. Just use the same path and the type MENU_LOCAL_TASK:
  62. $items['admin/settings/seo_checker/YOUR_MODULE'] = array(
  63. 'title' => ...
  64. ... => ...
  65. 'type' => MENU_LOCAL_TASK,
  66. )