|
|
|
|
|
- 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
Changing sites from AWP to SEO-ready session mode
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.
For greater security, it is not necessary to reference all pages in Session mode: the developer chooses which pages to reference. 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 website 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.
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. Follow these steps: - Changing the type of site.
- Choosing the pages that will be SEO-ready.
- Deleting the AWP context management code.
- Choosing the images that will be SEO-ready.
- Modifying the URL generation code.
- 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: - Open the project description window. To do so, go to the "Project" tab, "Project" group, and click "Description".
- In the "Project" tab of the project description window, in "Type of site", select "Session".
- On 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.
- 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. It is also possible to speak of "addressable" 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: - Display the page description window: under the "Page" pane, in the "Description" group, click on "Description"..
- In the "General" tab:
- Select the page type: "Session".
- If the page is SEO-ready, check "SEO-ready". If necessary, change the name to be used in the URI.
- Validate.
Note: Switching pages to searchable 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". - The context is initialized with ConfigureAWPContext. For example:
ConfigureAWPContext(ctxDisk, ctxIDCookieURL)
- The variables to be stored in the AWP context are specified with DeclareAWPContext.
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/or modify different points: - The Image control should not use any compatibility mode. To check the Image control mode:
- Open the Image control description window.
- On the "Details" tab, go to the "Compatibility mode" option and change it, if necessary. This option must be set to "None".
- 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.
- On the "General" tab, check the image display mode used. If necessary, change the image transformation mode so that the image is transformed on the browser side.
Caution: the calculation mode (server or browser) has an impact on how the image is programmatically assigned. - 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 searchable, as 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.
Note: in AWP, images are often placed in language subdirectories.. 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.
- call to WLanguage function ScriptDisplay.
This code must be modified to use PageAddress. - make sure that the links built lead to "SEO-ready" pages.
For a page that does not have the "searchable" property activated, access to the page cannot be via a link: it must be made via the PageDisplay function.
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|