Best way to transform large groups of web pages?

Best way to transform large groups of web pages?

孤独患者 发布于 2021-11-27 字数 985 浏览 679 回复 2 原文

What is the best way to transform large bunches of very similar web pages into a newer css-based layout programatically?

I am changing all the contents of an old website into a new css-based layout. Many of the pages are very similar, and I want to be able to automate the process.

What I am currently thinking of doing is to read the pages in using HtmlAgilityPack, and make a method for each group of similar pages that will create the output text.

What do you think is the best way to do this? The pages mostly differ by things like which .jpg file is used for the image, or how many groups of heading-image-text there are on that particular page

EDIT: I cannot use any other file type than .html, as that is all I am authorized to do. Any suggestions?

EDIT2: Ideally, I would also be able to make this be generic enough that I could use it for many different groups of html files by just switching around a few moving parts.

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

扫码加入群聊

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

埖埖迣鎅 2022-06-07 2 楼

What about using Server Side Includes (SSI) <#!--#INCLUDE -->

This was you can create different parts of your webpage in different files and just "include" them in any other page you want.

header.html
body.html
footer.html

<html>
<!--#INCLUDE file="header.html" -->
<!--#INCLUDE file="body.html" -->
<!--#INCLUDE file="footer.html" -->
</html>

More info here

驱逐舰岛风号 2022-06-07 1 楼

Sounds like you should be re-using code. If you are using strictly HTML, I would consider doing PHP or ASP based webpages instead. That way, you can create Header/Content/Footer/Nav sections, and re-use the same code across all your webpages.

This would make it a lot more sustainable, as you would only need to edit one file in the future.