PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Overview
  • How to?
  • Overview
  • 1. Changing the type of site
  • 2. Choosing the pages that will be SEO-ready
  • 3. Deleting the AWP context management code
  • 4. Choosing and configuring the images that will be SEO-ready
  • 5. Modifying the URL generation code
  • 6. Deleting the connection verification code
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Changing sites from AWP to SEO-ready session mode
AjaxNot available
Overview
Starting with version 27, WEBDEV includes a session mode with SEO-ready pages. This mode allows you to enable SEO for the desired pages while taking advantage of the session mode:
  • between two calls, the session remains in memory on the server, which results in faster pages
  • there is no need to manage session variables manually, making programming easier.
It is not necessary to enable SEO for all the pages in Session mode, which improves security: the developer decides which pages will be SEO-ready.
Changing from AWP to SEO-ready session mode is not recommended for sites with a large number of connections.
Reminder: Until version 27, the AWP mode was the preferred solution to make any page of a WEBDEV site SEO-ready.
However, this mode has some constraints:
  • For each page, it is necessary to reconnect to the database, reload the site status variables, etc.: pages take a little longer to initialize, thus increasing the load on the database server.
  • User authentication data, as well as the current session must be kept in the "AWP context" using the WLanguage DeclareAWPContext function. Some complex variables require data serialization, which makes processes even slower.
  • As each page has its own accessible address, it is difficult to secure "private" pages within the site. It is therefore necessary to check if a user is logged in and if they are granted access to the page.
How to?

Overview

This help page presents step-by-step a method for converting an AWP site to "SEO-ready session" mode.
The "WW_TamesShop" online store example included in WEBDEV is used as support in this page.
The different steps are as follows:
  1. Changing the type of site.
  2. Choosing the pages that will be SEO-ready.
  3. Deleting the AWP context management code.
  4. Choosing the images that will be SEO-ready.
  5. Modifying the URL generation code.
  6. Deleting the connection verification code.

1. Changing the type of site

As the site is in AWP mode, the first step consists of changing the type of site to Session mode:
  1. Open the project description window: on the "Project" tab, in the "Project" group, click "Description".
  2. In the "Project" tab of the project description window, in "Type of site", select "Session".
  3. In the "Advanced" tab, make sure the "Don't disconnect inactive users" option is unchecked. This option is not compatible with pages in SEO-ready session mode.
  4. Validate the project description window.

2. Choosing the pages that will be SEO-ready

In the site in Session mode, you must choose which pages will be SEO-ready. It is not necessary to enable SEO for every single page of a site. This can also be referred to as "indexable" pages: these pages can be found by their address, and if the associated context still exists, the content can be displayed.
For example, in "WW_TamesShop":
  • all the pages of the store must be directly accessible and be SEO-ready.
  • this is not the case for the pages of the "CustomerSectionPage" internal component since it is a private part of the site. This part of the site must be accessible to users only after they log in.
  • the pages of the "EcommercePage" internal component make up the conversion funnel (pages used to manage the shopping cart and checkout). Likewise, there is no need to make these pages SEO-ready.
Each page of the site must be changed to Session mode. Where necessary, indicate which pages must be SEO-ready. For each page:
  1. Open the page description window: on the "Page" tab, in the "Description" group, click "Description".
  2. In the "General" tab:
    • Select the type of page: "Session".
    • If the page is SEO-ready, check "SEO-ready". If necessary, change the name to be used in the URI.
  3. Validate.
Remark: Changing pages to SEO-ready session mode changes the file extension in the URL. The pages will become '.wb' files.

3. Deleting the AWP context management code

In AWP mode, the variables to be kept between two page calls are stored in the "AWP context".
  1. The context is initialized with ConfigureAWPContext. For example:
    // Declare an AWP context
    ConfigureAWPContext(ctxDisk, ctxIDCookieURL)
  2. The variables to be stored in the AWP context are specified with DeclareAWPContext.
    // Is there a logged-in client?
    DeclareAWPContext(gnCurrentClient)
In SEO-ready session mode, this mechanism is no longer necessary.
It is therefore essential to find the calls to ConfigureAWPContext and DeclareAWPContext and delete the corresponding code.

4. Choosing and configuring the images that will be SEO-ready

You must also specify which images must be SEO-ready.
To make an Image control SEO-ready, you need to check and and/or modify different points:
  1. The Image control should not use any compatibility mode. To check the Image control mode:
    • Open the Image control description window.
    • In the "Details" tab, go to the "Compatibility mode" option and change it, if necessary. This option must be set to "None".
  2. If the Image control uses a specific display mode (stretched, homothetic, etc.), the browser must calculate the image to make it SEO-ready. Conversely, to prevent an image from being SEO-ready, it must be calculated by the server in the current session.
    • If necessary, open the Image control description window.
    • In the "General" tab, check the image display mode used. If necessary, change the image transformation mode so that the the image is transformed on the browser side.
Caution: the calculation mode (server or browser) changes how the image should assigned in the code.
  • Image calculated on the server side: The image must be assigned to the control by specifying the path to the image file on disk. To get the image directory, use fDataDir or fWebDir.
    Reminder: in this case, the image will not be SEO-ready because it is calculated by the server in the current session.
  • Image calculated on the browser side: The image must be assigned by specifying the URL. You can use:
    • an absolute URL. An absolute URL is a URL that starts with "http://", "https://" or only "://" (to use the same protocol as the page).
    • a relative URL. In this case, WEBDEV interprets the URL as relative to the "_WEB" directory of the project. The images must therefore be stored in this directory (or in a subdirectory).
      In a multilingual application, you can have an image subdirectory per language.
Remark: in AWP mode, images are often stored in the subdirectory of each language. In most cases, you will need to modify the code or move the images.

5. Modifying the URL generation code

In AWP mode, you can use the AWP context identifier to build a URL programmatically. This identifier is returned by IdentifierAWPContext.
Here is a code example:
sLink is string = gsURLPageViewProduct +"?P1="+ nProductID + ...
"&P2="+nProductVariationID+["&"] + IdentifierAWPContext()
In SEO-ready Session mode:
  • The IdentifierAWPContext function no longer serves a purpose.
  • The identifier of the current session is still required. If this identifier is not present in the URL, a new session will be created on the server.
In session mode, the session identifier is broken down into two parts:
  • a first part automatically stored and transferred in a cookie,
  • a second part stored in the URL, in a parameter named "REFID". To stay in the same session, this parameter must not change.
In this case, use PageAddress to build the URL of a page.
This function automatically adds the current value of the REFID parameter to the URL of the page.
In our AWP example "to convert ", it is necessary to:
  • check if the code contains page URLs built programmatically. Here are the most common cases:
    • a value is assigned to the URL property of certain controls (TreeView, Link, etc.).
    • the code of the Breadcrumb control is specified.
    • ScriptDisplay is called.
    This code must be modified to use PageAddress.
  • make sure that the links built lead to "SEO-ready" pages.
    When the "SEO-ready" option is not enabled, the page cannot be accessed via a link: this must be done via PageDisplay.

6. Deleting the connection verification code

In AWP mode, if the site has a part that requires users to log in (e.g., a customer's profile), you must make sure that a given user has actually logged in before displaying each page of this part.
The following code is often used:
IF bIsLoggedIn() = False THEN
ScriptDisplay(gsURLLoginPage)
END
In SEO-ready session mode, simply indicate that these pages are not meant for SEO.
The code that verifies that a client is logged in can therefore be deleted.
Minimum version required
  • Version 27
Comments
Click [Add] to post a comment