Static webpage generation method and device, equipment and medium
By building and splicing reusable units, the hypertext markup language file is generated, which solves the problem that static web page maintenance personnel need to have code modification capabilities, and realizes low-threshold static web page development and maintenance, which is suitable for high-frequency update scenarios.
Patent Information
- Application Number
- CN202510249944.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-04
- Publication Date
- 2025-06-10
AI Technical Summary
Maintenance personnel of static web pages need to have the ability to modify code, which leads to high technical thresholds and high modification costs.
By building a reusable unit, including reusable unit identification information and configuration information, data input configuration and style configuration, multiple reusable units are spliced based on preset order, and hypertext markup language files are generated to realize the generation and maintenance of static web pages.
It lowers the threshold for static web page development and maintenance, improves development efficiency and maintainability, and is suitable for high-frequency update scenarios such as enterprise official websites and marketing activity pages.
Smart Images

Figure CN120123612A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of web page configuration, and in particular to a method, device, equipment and medium for generating static web pages. Background Art
[0002] In the related art, for the maintenance and update of static web pages, developers modify HyperText Markup Language (HTML for short) files, and upload the modified files to the server to complete the update of the web pages.
[0003] However, this method requires the maintainers of static web pages to have the ability to modify code, and the development threshold is relatively high, resulting in a relatively high cost for modifying static web pages. Summary of the Invention
[0004] In view of this, the present invention provides a method, device, equipment and medium for generating static web pages, so as to solve the problem that the maintainers of static web pages need to have the ability to modify code, the technical threshold is high, and the cost of modifying static web pages is high.
[0005] In a first aspect, the present invention provides a method for generating a static web page, the method comprising: constructing reusable units, the reusable units including reusable unit identification information and configuration information, the configuration information including data input configuration and style configuration; splicing a plurality of the reusable units based on a preset order to construct a static web page template; loading target configuration information based on the order of the reusable units represented by the target static web page template to generate a HyperText Markup Language file, and presenting static web page content to a user based on the HyperText Markup Language file.
[0006] In an optional implementation manner, the constructing the reusable units includes: constructing the reusable units based on basic information, where the basic information includes the reusable unit identification information, and the basic information further includes at least one of the following data: Cascading Style Sheets class name, the name of the reusable unit, the description of the reusable unit, the status of the reusable unit, and the preview effect diagram of the reusable unit.
[0007] In an alternative embodiment, loading a plurality of configuration files in the order of the reusable units characterized by the target static web page template, generating a HyperText Markup Language file, and presenting static web page content to a user based on the HyperText Markup Language file includes: loading a plurality of configuration files in the order characterized by the target static web page template, generating a HyperText Markup Language preview page, and reviewing the HyperText Markup Language preview page; if the HyperText Markup Language preview page passes the review, loading a plurality of configuration files in the order characterized by the target static web page template to generate the HyperText Markup Language file, wherein the storage paths of the HyperText Markup Language preview page and the HyperText Markup Language file are different.
[0008] In an alternative embodiment, loading a plurality of configuration files in the order of the reusable units characterized by the target static web page template, generating a HyperText Markup Language file, and presenting static web page content to a user based on the HyperText Markup Language file further includes: determining the target static web page template based on usage requirements among a plurality of the static web page templates; determining filling configuration information for filling the reusable units in the target static web page template; determining a list of reusable units based on the target static web page template; loading a renderer script corresponding to the order of the list of reusable units, wherein the configuration information of the reusable unit includes the renderer script; passing the filling configuration information into the renderer script corresponding to the filling configuration information to generate a HyperText Markup Language fragment; and splicing the HyperText Markup Language fragments to generate the HyperText Markup Language file.
[0009] In an alternative embodiment, determining the filling configuration information for filling the reusable units in the target static web page template includes dynamically obtaining the filling configuration information based on a form, an application programming interface, or a database query.
[0010] In an alternative embodiment, the method further includes performing version control on the static web page template: generating a content hash value of the static web page template based on the static web page template; and generating a new static web page template if the content hash value changes.
[0011] In a second aspect, the present invention provides an apparatus for generating a static web page. The apparatus includes: a first construction module for constructing reusable units, where the reusable units include reusable unit identification information and configuration information, and the configuration information includes data input configuration and style configuration; a second construction module for splicing a plurality of the reusable units based on a preset order to construct a static web page template; and a generation module for loading target configuration information in the order of the reusable units characterized by the target static web page template, generating a HyperText Markup Language file, and presenting static web page content to a user based on the HyperText Markup Language file.
[0012] In a third aspect, the present invention provides a computer device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to execute the method for static web page generation according to the first aspect or any corresponding embodiment thereof.
[0013] In a fourth aspect, the present invention provides a computer-readable storage medium, on which computer instructions are stored, and the computer instructions are used to cause a computer to execute the method for static web page generation according to the first aspect or any corresponding embodiment thereof.
[0014] In a fifth aspect, the present invention provides a computer program product, including computer instructions, and the computer instructions are used to cause a computer to execute the method for static web page generation according to the first aspect or any corresponding embodiment thereof.
[0015] The modularization of static page content is realized through reusable units, which supports hot plugging, and can improve development efficiency and maintainability; decoupling the layout from the content based on reusable units can achieve flexible adjustment of the page structure; separating data input configuration from style configuration and supporting multi-environment version management can improve iteration efficiency; non-technical personnel can build static web page templates by splicing multiple reusable units, which reduces the development threshold of static web pages, and non-technical personnel can also maintain static web pages, solving the problems of high maintenance cost and poor reusability in related technologies, and is applicable to high-frequency update scenarios such as enterprise official websites or marketing activity pages. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the related art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0017] Figure 1 Shows a schematic flowchart of the method for static web page generation according to an embodiment of the present invention;
[0018] Figure 2 Shows a schematic flowchart of the method for static web page generation according to an embodiment of the present invention;
[0019] Figure 3 Shows a schematic structural diagram of the device for static web page generation according to an embodiment of the present invention;
[0020] Figure 4It is a schematic diagram of the hardware structure of the computer device according to an embodiment of the present invention. Detailed implementation manners
[0021] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0022] In related technologies, generating a static web page through visual editing requires a learning cost. Moreover, visual editing tools usually provide preset templates and components. Although they are convenient and easy to use, they cannot meet the specific needs of all users.
[0023] According to an embodiment of the present invention, a method embodiment for generating a static web page is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0024] In this embodiment, a method for generating a static web page is provided, which can be used for a terminal such as a mobile phone, a tablet computer, or a desktop computer, etc. Figure 1 shows a flowchart of the method for generating a static web page according to an embodiment of the present invention, as Figure 1 shown, the process includes the following steps:
[0025] Step S101, construct a reusable unit, the reusable unit includes reusable unit identification information and configuration information, and the configuration information includes data input configuration and style configuration.
[0026] In this step, the reusable unit (block) can be provided by a front-end developer. The reusable unit identification information can be an identifier (abbreviated as ID), and based on the identifier, the uniqueness of each identified reusable unit in the system can be ensured. The reusable unit, as the smallest functional unit constituting the static web page, is used to define the content structure, style, and interaction logic. The data input configuration (cells) in the configuration information (config) is used to define the content fields that can be filled by the user, such as text or picture paths, etc., and the rules such as the type of input item or whether it is required can be described through the form attribute.
[0027] The style configuration (css) in the configuration information (config) supports global styles and field-level independent styles, which can ensure visual consistency of static web pages. Specifically, the description of the data input box can be configured through the form attribute, and for the css configuration of the form attribute, it is used to configure the style of the form attribute. For example, the data input configuration (cells) includes the description of the data input box characterized by the form attribute, the style of the form attribute configured based on the css attribute, and the common style configuration of the reusable unit (block).
[0028] The rendering logic (renderer) in the configuration information can define the HTML generation logic using template strings through the renderer script field (script).
[0029] The relevant code examples are as follows:
[0030]
[0031]
[0032] Step S102: Assemble multiple reusable units based on a preset order to construct a static web page template.
[0033] In this step, the static web page template can be written by non-technical personnel such as website maintenance personnel who do not have a background in code development, for example, personnel responsible for web page copywriting, to construct the static web page template. By combining multiple reusable units (blocks), the page structure and layout are defined. The website maintenance personnel can determine the preset order according to the static page display requirements, select the reusable units (blocks), and store the identifiers (IDs) and order indexes of the reusable units, such as the list [blockId1, blockId2]. Decoupling the static web page template from the reusable units means that in the case of adjusting the order or replacing the reusable units (blocks), there is no need to modify the instance data. This facilitates subsequent adjustment of the order of the reusable units. The instance generated based on the static web page template can follow the order of the reusable units in the static web page template to adjust the display order of the instance. Among them, the instance is an HTML file generated after filling the content and style in the static web page template.
[0034] According to the list of reusable unit identifiers in the static web page template, the configuration information of the corresponding reusable units is loaded in real time to ensure dynamic adaptation of content filling and style configuration. For the same type of static web pages, the static web page template can be reused.
[0035] Step S103: Based on the order of the reusable units characterized by the target static web page template, load the target configuration information, generate a HyperText Markup Language (HTML) file, and present the static web page content to the user based on the HTML file.
[0036] In this step, combine the content filled by the website maintainer with the static web page template to generate the final HTML file. After the website maintainer selects the static web page template, load the configuration fields of all reusable units in the static web page template based on the preset order, and provide a visual form for the website maintainer to input content according to the data input configuration of each reusable unit. For example, it can be a title, an image, or a Uniform Resource Locator (URL). Support the website maintainer to customize and override the default style of the reusable unit, which can be achieved by configuring the css field.
[0037] Parse the renderer script field of each reusable unit, pass the content filled by the website maintainer as a parameter, generate the corresponding HTML field, and splice the HTML codes of all reusable units based on the order of the static web page template to form a complete page. The preview page can generate a temporary file, such as preview.html, which is isolated from the production environment page index.html to avoid confusion.
[0038] The method for generating a static web page provided in this embodiment realizes the modularization of the static page content through reusable units, supports hot pluggability, and can improve the development efficiency and maintainability; decouples the layout from the content based on the reusable units, and can flexibly adjust the page structure; separates the data input configuration from the style configuration, supports multi-environment version management, and can improve the iteration efficiency; non-technical personnel can build a static web page template by splicing multiple reusable units, reducing the development threshold of static web pages. Non-technical personnel can also maintain static web pages, solving the problems of high maintenance cost and poor reusability in the related technology, and is applicable to high-frequency update scenarios such as enterprise official websites or marketing activity pages.
[0039] In some alternative embodiments, constructing a reusable unit includes: constructing a reusable unit based on basic information, where the basic information includes reusable unit identification information, and the basic information further includes at least one of the following data: Cascading Style Sheet (CSS) class name, name of the reusable unit, description of the reusable unit, status of the reusable unit, and preview effect diagram of the reusable unit.
[0040] In this embodiment, the basic information model can be described using JSON Schema or Protocol Buffers to ensure cross-platform data compatibility. The reusable unit information is stored as an independent configuration file or database table, and the state changes (such as enable / disable) are managed through version control.
[0041] The pseudo-code of the reusable unit configuration file structure is as follows:
[0042]
[0043]
[0044] Among them, "id" is used to represent the identifier of the reusable unit, "class" is used to represent the CSS class name of the reusable unit, "name" is used to represent the name of the reusable unit, "desc" is used to describe the reusable unit, "state" is used to represent the state of the reusable unit, including active or inactive, "preview" is used to represent the path of the effect preview image of the reusable unit, hinting how to fill in the instance content and the filling effect, "config" is used to represent the configuration information of the reusable unit, including data input configuration (cells) and style configuration (css), "renderer" is used to represent the renderer of the reusable unit, including inline style and the script for generating HTML. Among them, the example of the HTML script is as follows:
[0045] stript = `
[0046] let style_text = "";
[0047] if(cfg.style){
[0048] let sty = cfg.style
[0049] style_text += `
[0050] .sty-${cfg.block_id}-${idx}{
[0051] ${sty.bg_img&&! / .json$ / .test(sty.bg_img)?`background-image:url(${sty.bg_img});`: ""}
[0052] ${sty.bg_color?`background-color:${sty.bg_color};`: ""}
[0053] ${sty.color? `color: ${sty.color};`: ""}
[0054] }\`
[0055] }
[0056] let nodeStr = "";
[0057] let cont = safeArray(cfg.content)[0] / / configuration information
[0058] nodeStr = ` <div class="sty-\${cfg.block_id}-\${idx}\${block.class}">
[0059] ${cont.desc?` <div class='desc\${cont.desc_mb?"pcshow":""}'>${cont.desc.replace( / \\r?\\n / g,' ')} `:”}
[0060] ${cont.desc_mb?` <div class='descmobileshow'>${cont.desc_mb.replace( / \\r?\\n / g,' ')} `:”}
[0061] \`
[0062] return {nodeStr, style_text}
[0063] `
[0064] A string can be converted into a method by using the new Function method. The conversion example is as follows:
[0065] let render =
[0066] new Function("cfg", 'block', "idx", block.renderer.script);
[0067] let renderStr = render(example filling information, block, index);
[0068] Multiple renderStr can be combined, and adding the HTML start and end tags can generate a page.
[0069] In this way, by standardizing metadata, duplicate code development can be reduced, and the development cycle can be shortened. At the same time, the reusable units can be updated flexibly, without relying on the website management platform, and can be directly saved in the database, facilitating the addition, deletion, and modification of reusable units. In this way, the block can be updated in real time without updating the management platform, facilitating timely response to requirements.
[0070] In this embodiment, a method for generating a static web page is also provided, which can be used for the above-mentioned terminals, such as mobile phones, tablets, or desktop computers, etc. Figure 2 shows a schematic flowchart of the method for generating a static web page according to an embodiment of the present invention, as Figure 2 shown, the process includes the following steps:
[0071] Step S201: Construct reusable units, where a reusable unit includes reusable unit identification information and configuration information, and the configuration information includes data input configuration and style configuration. For details, please refer to Figure 1 Step S101 of the embodiment shown, which will not be elaborated here.
[0072] Step S202: Based on a preset order, splice multiple reusable units to construct a static web page template. For details, please refer to Figure 1 Step S102 of the embodiment shown, which will not be elaborated here.
[0073] Step S203: Based on the order of the reusable units represented by the target static web page template, load the target configuration information to generate a HyperText Markup Language file, and present the static web page content to the user based on the HyperText Markup Language file.
[0074] Specifically, the above Step S203 includes:
[0075] Step S2031: Based on the order represented by the target static web page template, load multiple configuration files to generate a HyperText Markup Language preview page and review the HyperText Markup Language preview page.
[0076] In this step, isolate the environment for the HTML preview page and the officially generated HTML page. An automated tool such as Lighthouse or W3C Validator can be used to automatically check the code specifications or performance of the page.
[0077] The HTML preview page can be reviewed hierarchically. The HTML preview page can be reviewed from at least one of the content layer, technology layer, business layer, or security layer. For example, the content of the HTML preview page can be reviewed from aspects such as text compliance or image copyright; the technical level of the HTML preview page can be reviewed from aspects such as cross-browser compatibility; the business level of the HTML preview page can be reviewed from the consistency between the page functions and the requirements document; and the security level of the HTML preview page can also be reviewed from aspects such as the trustworthiness of third-party resources.
[0078] Configuration verification, template-instance consistency, and multi-environment verification can also be performed on reusable units. Specifically, check whether the required fields of cells in the config are compulsorily verified, and prevent page generation when required fields are not filled. Verify whether the HTML code generated by renderer.script contains redundant tags or unclosed elements. After adjusting the Block order in the template, the rendering results of related instances need to be re-audited (such as incorrect dynamic loading order). After filling the instance content, compare the preview page with the production page to ensure there are no configuration override conflicts. The preview environment allows temporary content (such as placeholder images), but a "test version" watermark needs to be marked. The production environment enables a caching policy (such as CDN caching of HTML files), and at the same time ensures a version rollback mechanism.
[0079] Manual review can also be performed on the HTML preview page. For example, content proofreading, design restoration, or interaction testing can be carried out manually.
[0080] Step S2032, if the HTML preview page passes the review, load multiple configuration files based on the order represented by the target static web page template to generate an HTML page. Among them, the storage paths of the HTML preview page and the HTML file are different.
[0081] In this step, a dual-path storage strategy is adopted. The preview page is stored in a temporary path for review and is migrated to the production environment path after the formal HTML page is generated, realizing the isolation of the development and deployment environments. When generating the preview page, a version hash value or timestamp identifier can be embedded, and after the review passes, an automated pipeline is triggered to update the formal page, while retaining historical versions to support quick rollback.
[0082] The HTML preview page is the same as the formal HTML page except for the jump links. You can first view the effect through the HTML preview page. After confirmation, generate the formal HTML page. The formal HTML page is used to display information to website users, and this setting can also avoid showing mistakes to users.
[0083] Both the formal HTML page and the HTML preview page are generated after saving the data. Click the preview to generate the preview page, submit for review, and generate the formal page after the review passes. The formal page is the page that users can access.
[0084] In this way, the modular configuration of reusable units supports independent updates. For example, modifying the css class name of a single component does not require reconstructing the overall template, reducing the maintenance cost; at the same time, the dual-path mechanism avoids affecting the stability of online services due to debugging in the preview environment and improves the troubleshooting efficiency.
[0085] In some alternative embodiments, multiple configuration files are loaded based on the order of reusable units characterized by a target static web page template, an HTML file is generated, and static web page content is presented to a user based on the HTML file. It further includes: determining a target static web page template from multiple static web page templates based on usage requirements; determining filling configuration information for filling reusable units in the target static web page template; determining a list of reusable units based on the target static web page template; loading a renderer script corresponding to the order of the list of reusable units, where the configuration information of the reusable unit includes a renderer script; passing the filling configuration information into the renderer script corresponding to the filling configuration information to generate an HTML fragment; and splicing the HTML fragments to generate an HTML file.
[0086] In this embodiment, according to the business scenario and user requirements, the most suitable target template for the current usage requirements is selected from multiple static web page templates. For the selected target template, the configuration information of the reusable units under the target template, i.e., the config field, is queried to clarify the reusable units to be filled and their specific configuration information, such as content, style, behavior, etc. Among them, cells determine the content that each reusable unit can fill, and css determines the style of the reusable unit. This information may come from user input, database query, or third-party service call. The instance will save the selected static web page template identifier and the filled content.
[0087] Based on the structure of the target template, a list of reusable units that matches it is dynamically generated or retrieved. Each unit corresponds to a unique identifier and a set of configuration parameters. According to the order of the list of reusable units, the corresponding renderer scripts are loaded one by one. These scripts are pre-written logical codes for converting configuration information into HTML fragments. The filling configuration information is passed as a parameter to the corresponding renderer script, and after the script execution, an HTML fragment containing user-customized content is output.
[0088] All the HTML fragments output by the renderer scripts are spliced together in a predetermined order to form a complete HTML document structure. The spliced HTML content is saved as a file and presented to the user through channels such as a web server or CDN. At the same time, a caching strategy can be implemented to improve the response speed.
[0089] Instances can also directly generate HTML preview pages or formal pages. Obtain the template identifier and filled content of the instance, sequentially search for reusable unit information by the template identifier, parse the script string under the renderer into a method, use the filled content of the instance as the method parameter, directly generate the HTML code end through the script method, stack multiple reusable units, generate a complete HTML page and save it to the background folder, and then the HTML page can be accessed at the specified location. The HTML page and the HTML preview page are two different files with different addresses, which can prevent confusion between the preview and production version pages.
[0090] In this way, through the use of templating and reusable units, the repetitive coding work is reduced, and the page construction speed is accelerated; both the template and reusable units can be independently updated and extended without modifying the overall framework, reducing the maintenance cost and enhancing the flexibility and scalability of the system; at the same time, the unified renderer script and configuration information transmission mechanism ensures the consistency and accuracy of content between different pages, improving the user experience.
[0091] In some alternative embodiments, determining the filling configuration information for reusable units in the target static web page template includes: dynamically obtaining the filling configuration information based on a form, an application programming interface, or a database query.
[0092] In this embodiment, when a website maintenance personnel submits information through a web form, the form data is submitted to a processing script or an application programming interface (API for short) on the server side. These form data contain the configuration information for filling reusable units, such as text content, option selections, etc. After receiving the form data, the server-side script or API validates and processes it, and then dynamically generates or updates the filling configuration information according to these data. These configuration information are then used to fill the reusable units in the target static web page template.
[0093] It is also possible to obtain the filling configuration information from an external service through an API request. These external services may be third-party data providers, internal databases, or other microservices. When calling the API, request parameters are usually sent to specify the required data type and format. The data contained in the API response is then parsed and used to fill the reusable units. For example, an e-commerce website may obtain product information, such as price, inventory, description, etc., through an API call, and then fill these information into the reusable units on the product details page.
[0094] It is also possible to directly query the required filling configuration information from the database. This typically involves executing an SQL query or a NoSQL query to retrieve data related to a specific reusable unit. The query results, i.e., data rows or documents, are then parsed and converted into an appropriate format for filling into the reusable units in the target static web page template. For example, a blog website may obtain information such as article titles, authors, publication dates, and article content through a database query, and then fill this information into the reusable units on the article page.
[0095] In this way, by dynamically obtaining the filling configuration information through form submissions, API calls, or database queries, the dynamic generation of static web page content can be achieved. This means that even with a static web page template, real-time updated content can be displayed. Since the filling configuration information is obtained dynamically, it is easy to change the data source or data format to adapt to different business requirements and scenarios. This makes the system more flexible and scalable.
[0096] In some alternative embodiments, the aforementioned method for generating static web pages further includes performing version control on the static web page template: based on the static web page template, generating a content hash value of the static web page template; if the content hash value changes, generating a new static web page template.
[0097] In this embodiment, each time a static web page template is generated or updated, the content of the static web page template file is first read. A hash algorithm, such as MD5, SHA-256, etc., can be used to perform a hash calculation on the content of the template file to generate a unique content hash value. The content hash value is stored, which can be stored in a version control file or in the metadata associated with the web page template file.
[0098] Each time a static web page is generated or updated, the content hash value of the template file is first read. Then, the content hash value of the current template file is calculated again. The calculated hash value is compared with the stored hash value. If the hash values are the same, it indicates that the template content has not changed, and the existing static web page can be continued to be used without regeneration. If the hash values are different, it indicates that the template content has changed, and at this time, a new static web page needs to be generated and the stored hash value needs to be updated.
[0099] In this way, through an automated version control process, the need for manual inspection and updating of static web pages is reduced, improving development efficiency. Using the hash value as the unique identifier of the template content can ensure that each generated static web page is based on the latest template content. This helps to avoid problems with inconsistent page content caused by out-of-sync updates of the template content.
[0100] In this embodiment, a device for static web page generation is also provided. This device is used to implement the above-mentioned embodiments and preferred implementation manners, and those that have been described will not be repeated. As used hereinafter, the term "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0101] This embodiment provides a device for static web page generation. Figure 3 The structural schematic diagram of the device for static web page generation according to the embodiment of the present invention is shown. As Figure 3 shown, it includes:
[0102] A first construction module 301, configured to construct reusable units. The reusable units include reusable unit identification information and configuration information. The configuration information includes data input configuration and style configuration.
[0103] A second construction module 302, configured to splice a plurality of reusable units based on a preset order to construct a static web page template.
[0104] A generation module 303, configured to load target configuration information based on the order of the reusable units represented by the target static web page template, generate a HyperText Markup Language file, and present static web page content to the user based on the HyperText Markup Language file.
[0105] In some optional implementation manners, the first construction module 301 includes:
[0106] The first unit of the first construction module is configured to construct reusable units based on basic information. The basic information includes reusable unit identification information, and the basic information further includes at least one of the following data: Cascading Style Sheet class name, name of the reusable unit, description of the reusable unit, status of the reusable unit, and preview effect diagram of the reusable unit.
[0107] In some optional implementation manners, the generation module 303 includes:
[0108] A first generation unit, configured to load a plurality of configuration files based on the order represented by the target static web page template, generate a HyperText Markup Language preview page, and review the HyperText Markup Language preview page; if the HyperText Markup Language preview page passes the review, load a plurality of configuration files based on the order represented by the target static web page template to generate a HyperText Markup Language page, where the storage path of the HyperText Markup Language preview page is different from that of the HyperText Markup Language file.
[0109] In some optional implementation manners, the generation module 303 further includes:
[0110] A second generation unit, configured to determine a target static web page template based on usage requirements from multiple static web page templates; determine filling configuration information for filling reusable units in the target static web page template; determine a list of reusable units based on the target static web page template; load a renderer script corresponding to the order of the list of reusable units, where the configuration information of the reusable unit includes the renderer script; pass the filling configuration information into the renderer script corresponding to the filling configuration information to generate a Hypertext Markup Language (HTML) fragment; splice the HTML fragments to generate an HTML file.
[0111] In some alternative embodiments, the second generation unit includes:
[0112] A first sub-unit of the second generation unit, configured to dynamically obtain the filling configuration information based on a form, an application programming interface, or a database query.
[0113] In some alternative embodiments, the aforementioned apparatus for static web page generation further includes:
[0114] A version control module, configured to generate a content hash value of the static web page template based on the static web page template; and generate a new static web page template if the content hash value changes.
[0115] The further function descriptions of the above-mentioned respective modules and units are the same as those in the corresponding foregoing embodiments, and will not be elaborated herein.
[0116] The apparatus for static web page generation in this embodiment is presented in the form of functional units. Here, the unit refers to an Application Specific Integrated Circuit (ASIC) circuit, a processor and a memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0117] This embodiment of the present invention further provides a computer device having the above-mentioned Figure 3 apparatus for static web page generation shown.
[0118] Please refer to Figure 4 , Figure 4 which is a schematic structural diagram of a computer device provided by an alternative embodiment of the present invention. As shown in Figure 4As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Each component communicates with each other using different buses and can be installed on a common motherboard or in other ways as needed. The processor can process instructions executed within the computer device, including instructions stored in the memory or on the memory to display graphical information of a graphical user interface on an external input / output device (such as a display device coupled to the interface). In some alternative embodiments, if needed, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple computer devices can be connected, and each device provides part of the necessary operations (such as an array of servers, a set of blade servers, or a multi-processor system). Figure 4 Taking one processor 10 as an example in
[0119] The processor 10 can be a central processing unit, a network processor, or a combination thereof. Among them, the processor 10 can further include a hardware chip. The above-mentioned hardware chip can be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The above-mentioned programmable logic device can be a complex programmable logic device, a field programmable gate array, a generic array logic, or any combination thereof.
[0120] Among them, the aforementioned memory 20 stores instructions executable by at least one processor 10, so that the aforementioned at least one processor 10 executes the method shown in the above embodiments.
[0121] The memory 20 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the computer device, etc. In addition, the memory 20 can include high-speed random access memory and can also include non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some alternative embodiments, the memory 20 can optionally include a memory remotely set relative to the processor 10, and these remote memories can be connected to the computer device through a network. Examples of the above-mentioned network include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0122] The memory 20 can include volatile memory, such as random access memory; the memory can also include non-volatile memory, such as flash memory, a hard disk, or a solid-state drive; the memory 20 can also include a combination of the above types of memory.
[0123] The computer device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30, and the output device 40 may be connected through a bus or other means. Figure 4 Take the connection through the bus as an example.
[0124] The input device 30 can receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the computer device, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, a pointing stick, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., a light-emitting diode), and a haptic feedback device (e.g., a vibration motor), etc. The above display device includes, but is not limited to, a liquid crystal display, a light-emitting diode, a display, and a plasma display. In some alternative embodiments, the display device may be a touch screen.
[0125] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or be implemented as computer code that can be recorded on a storage medium, or be implemented by downloading through a network and originally stored in a remote storage medium or a non-transitory machine-readable storage medium and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk, or a solid-state drive, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by the computer, the processor, or the hardware, the method shown in the above embodiment is implemented.
[0126] A part of the present invention can be applied as a computer program product, such as computer program instructions. When executed by a computer, through the operation of the computer, the methods and / or technical solutions according to the present invention can be called or provided. Those skilled in the art should be able to understand that the forms of existence of computer program instructions in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible by the computer.
[0127] Although embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A method for generating static web pages, characterized in that: The method comprises: Constructing a reusable unit, wherein the reusable unit includes reusable unit identification information and configuration information, wherein the configuration information includes data input configuration and style configuration; Based on a preset order, multiple reusable units are spliced to construct a static web page template; Based on the sequence of reusable units represented by the target static webpage template, target configuration information is loaded, a hypertext markup language file is generated, and static webpage content is presented to the user based on the hypertext markup language file.
2. The method according to claim 1, characterized in that: The construction of the reusable unit includes: The reusable unit is constructed based on basic information, wherein the basic information includes identification information of the reusable unit, and the basic information also includes at least one of the following data: a cascading style sheet class name, a name of the reusable unit, a description of the reusable unit, a status of the reusable unit, and a preview effect diagram of the reusable unit.
3. The method according to claim 1 or 2, characterized in that: The method comprises: loading a plurality of configuration files based on the order of the reusable units represented by the target static webpage template, generating a hypertext markup language file, and presenting static webpage content to the user based on the hypertext markup language file, including: Based on the order of the target static webpage template representation, multiple configuration files are loaded, a hypertext markup language preview page is generated, and the hypertext markup language preview page is reviewed; If the hypertext markup language preview page passes the review, multiple configuration files are loaded based on the order of the target static web page template representation to generate the hypertext markup language page, wherein the storage path of the hypertext markup language preview page is different from that of the hypertext markup language file.
4. The method according to claim 1 or 2, characterized in that: The method further comprises: loading a plurality of configuration files based on the order of the reusable units represented by the target static web page template, generating a hypertext markup language file, and presenting static web page content to the user based on the hypertext markup language file; Determining the target static web page template among the plurality of static web page templates based on usage requirements; Determine filling configuration information for filling reusable units in the target static web page template; Based on the target static web page template, determining a list of reusable units; Loading a renderer script corresponding to the order of the reusable unit list, wherein the configuration information of the reusable unit includes the renderer script; Passing the fill configuration information into a renderer script corresponding to the fill configuration information to generate a hypertext markup language fragment; The hypertext markup language segments are spliced together to generate the hypertext markup language file.
5. The method according to claim 4, characterized in that The determining of filling configuration information for filling the reusable unit in the target static webpage template includes: dynamically acquiring the filling configuration information based on a form, an application program interface or a database query.
6. The method according to claim 1, characterized in that The method further includes performing version control on the static webpage template: Based on the static webpage template, generating a content hash value of the static webpage template; If the content hash value changes, a new static web page template is generated.
7. A device for generating static web pages, characterized in that: The device comprises: A first construction module is used to construct a reusable unit, wherein the reusable unit includes reusable unit identification information and configuration information, wherein the configuration information includes data input configuration and style configuration; A second construction module is used to construct a static web page template by splicing a plurality of the reusable units based on a preset order; The generation module is used to load the target configuration information based on the sequence of the reusable units represented by the target static web page template, generate a hypertext markup language file, and present the static web page content to the user based on the hypertext markup language file.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for generating static web pages according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for generating a static web page according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the method for generating static web pages according to any one of claims 1 to 6.