ePages 6.17.52 - DE_EPAGES/SEO/API/SEO.pm

Package DE_EPAGES::SEO::API::SEO

API functions for SEO check on content objects

@EXPORT_OK
GetSEOCheckValues
CalculateSEOQuality
GetSEOQualityClass
AddCategoryImageSEOCheckValues
AddCategoryDepthSEOCheckValues
GetShopSEOQualityValues
CalculateShopSEOQuality
GetRatingSign
PerformSEOCheck
PerformStartPageSEOCheck
PerformSEOCheckAndUpdateObject
UpdateSEOQuality
CheckForBadSEOHTML

Functions

AddCategoryDepthSEOCheckValues
AddCategoryImageSEOCheckValues
CalculateSEOQuality
CalculateShopSEOQuality
CheckForBadSEOHTML
GetRatingSign
GetSEOCheckValues
GetSEOQualityClass
GetShopSEOQualityValues
PerformSEOCheck
PerformSEOCheckAndUpdateObject
PerformStartPageSEOCheck
UpdateSEOQuality

AddCategoryDepthSEOCheckValues

Extends hValues with SEO check for the category hierarchy depth.

Syntax
AddCategoryDepthSEOCheckValues($Object, $Shop, $hValues)
Input
$Object (object)
content object
$Shop (object)
shop object
$hValues (ref.hash)
values and ratings for SEO check

AddCategoryImageSEOCheckValues

Extends hValues with SEO check for the category image.

Syntax
AddCategoryImageSEOCheckValues($Object, $Shop, $hValues)
Input
$Object (object)
content object
$Shop (object)
shop object
$hValues (ref.hash)
values and ratings for SEO check

CalculateSEOQuality

Calculates a rating factor which determindes the SEO quality based on the given values in $hValues.

Syntax
$Rating = CalculateSEOQuality($hValues, $Object)
Input
$hValues (ref.hash)
values and ratings for SEO check
$Object (object)
content object
Return
$Rating (integer)
SEO quality from 0 .. 100

CalculateShopSEOQuality

Calculates a rating factor which determindes the SEO quality for the shop.

Syntax
$Rating = CalculateShopSEOQuality($hValues)
Input
$hValues (ref.hash)
values and ratings for SEO check
Return
$Rating (integer)
SEO quality from 0 .. 100

CheckForBadSEOHTML

Checks if $Code contains any HTML markup that is horrible for SEO. This for example are title and meta tags, entire new html documents, etc.

Syntax
$IsOk = CheckForBadSEOHTML($Code)
Input
$Code (string)
html code
Return
$IsOk (boolean)
1 of html code is ok, 0 if not

GetRatingSign

Returns the html character code for the given SEO rating class string.

Syntax
$Sign = GetRatingSign($RatingClass)
Input
$RatingClass (string)
class string like "red", "yellow", ...
Return
$Sign (string)
html character code

GetSEOCheckValues

Calculates various SEO relevant ratings and values for ContentObject SEO checks. Values specific to derived classes can be added/changed unsing a hook.

Syntax
$hValues = GetSEOCheckValues(Shop, $Object, $LanguageID);
Input
$Shop (object)
shop
$Object (object)
content object
$LanguageID (integer)
language id for localized attributes
Return
$hValues (ref.hash)
values and ratings for SEO check, can be extended via hooks
  • Name - object name - string

    • Title
    • Value - text of the title tag - string
    • Rating - SEO rating for the title tag - integer
    • RatingClass - CSS class name depending on Rating - string
    • Characters - Number of characters in the title tag - integer
    • Words - Number of words in the title tag - integer
    • Percentage - weighting for the SEO rating for the title tag - float

    • Url ...
    - canonical URL data (similar to Title)
    • Description ...
    - description meta tag data (similar to Title)
    • AdvDescription ...
    - long description data (similar to Title)
  • ... (more values can be added via hook SEOCheckLocalizedTests)

GetSEOQualityClass

Returns the CSS class string depending on the SEO quality value.

Syntax
$QualityClass'} = GetSEOQualityClass($Quality);
Input
$Quality (integer)
SEO quality 0 .. 100
Return
$Class (string)
css class string

GetShopSEOQualityValues

Calculates the SEO quality for the shop. Uses general indicators like domain name, page cache, etc.

Syntax
$hValues = GetShopSEOQualityValues($Shop)
Input
$Shop (object)
Shop
Return
$hValues (ref.hash)
values and ratings for SEO check of the shop, extendable via hooks

    • DomainName
    • Rating - SEO rating for the title tag - integer
    • RatingClass - CSS class name depending on Rating - string

    ...
  • ShopQuality
  • ...

PerformSEOCheck

Performs the calculation of the SEO quality.

Syntax
$hValues = PerformSEOCheck($Object)
Input
$Object (object)
content object
Return
$hValues (ref.hash)
values and ratings for SEO check of the shop

    • 1
    • NewSEOQuality - SEO quality for the object for language id 1 - integer
    • NewSEOQualityClass - CSS class name depending on rating - string

    ...
  • NewSEOQuality - total SEO quality for the object - integer
  • NewSEOQualityClass - CSS class name depending on rating - string
  • ...

PerformSEOCheckAndUpdateObject

Performs the calculation of the SEO quality. Then calls the UpdateSEOQuality method to update the object.

Syntax
PerformSEOCheckAndUpdateObject($ContentObject)
Input
$ContentObject (object)
content object

PerformStartPageSEOCheck

Performs the calculation of the SEO quality for the StartPage.

Syntax
$hValues = PerformStartPageSEOCheck($Object)
Input
$Object (object)
content object
Return
$hValues (ref.hash)
values and ratings for SEO check of the shop

    • 1
    • NewSEOQuality - SEO quality for the object for language id 1 - integer
    • NewSEOQualityClass - CSS class name depending on rating - string

    ...
  • NewSEOQuality - total SEO quality for the object - integer
  • NewSEOQualityClass - CSS class name depending on rating - string
  • ...

UpdateSEOQuality

Saves the new SEO quality values. See PerformSEOCheck method for details of the $hValues parameter. This method only traverses the per-language data of $hValues and uses the contained 'NewSEOQuality' value to save those quality values.

Syntax
UpdateSEOQuality($Object, $hValues);
Example
my $Object = $Servlet->object;
my $hValues = PerformSEOCheck($Object);
UpdateSEOQuality($Object, $hValues);
Input
$Object (object)
content object
$hValues (ref.hash)
values and ratings for SEO check of the shop

    • 1
    • NewSEOQuality - SEO quality for the object for language id 1 - integer

      2
    • NewSEOQuality - SEO quality for the object for language id 2 - integer

    ...
  • ...