Relevant Main Contents Component
The Relevant Main Contents is recommendation part to show links to the main contents from the blog article page.
The Relevant Main Contents is used on the Blog Article Page Template. This component shows relevant Html section of the main contents like below.
This CMS has the main contents and blog articles in a website. The blog articles support the main contents, and the main contents are like the blog categories with rich contents.
The component lists the links to Html section which are relevant to the blog article. The sections are calculated by the keyword tags of the blog article.
The source code is Relevant Main Contents Component consists of Html code, server side program, and Style Sheet.
The source code is similar to the More Topics Link component. The More Topics Link component shows relevant topics section of the all contents, but this component shows only of the main contents.
The html code of Relevant Main Contents Component is below.
The Html code uses the "@pages" array variable has the title of the link to article and the url. This variable is created by the server side program.
The server side program of Relevant Main Contents Component is below.
The main goal of the server side program is to create the "@pages" variable by following operation.
Set limit number of the recommendation links
At first, set the maximum number of the result as the "$limit" variable.
Select main content pages which has common keyword tags
In order to calculate the score of Html section, get the candidate of main content pages by the SQL query.
The candidate pages are ones which has common keyword tags.
Score the pages
The "HtmlFtech.evaluatePageScore()" function is to score the candidate page, and select the Html section for the result. The Html section to select starts with the header tag, which is h2,h3, or h4 tag.
This function score the text of the content by using keyword tag's semantic setting.
Sort the array variable
After calculating the score of the Html section, sort them by the score.
Trim the low score value from the array
The number of the candidates is more than the limit number, it is twice of the limit. Therefore, it have to trim the candidates with low score.
The Style Sheet of Relevant Main Contents Component is below.
When you change the design of this component, please change this Style Sheet.