0

I have a folder containing some HTML files with images and links between these HTML files. I'd like to import this folder to Wordpress such that each HTML page becomes a Wordpress page (that can be edited later) and the links between them is kept correctly. What is the best way to do that?

1 Answer 1

0

It depends on what the HTML contains. You might be able to create a script that reads each HTML file, inserts a Page, adds Media, and populates the content - but that will likely be more effort than manually setting the pages up yourself in the Editor.

I'm not sure you could fully script the links as content, unless you first create a Page for each HTML file and save its slug, then populate the content of each Page separately (so its slug already exists and will point to a valid URL).

HTML can contain so much, and WordPress themes usually output a sitewide header and footer - so your opening <html> tag, the <head></head> tag, etc. are likely not to be something you want pulled into the actual Page content. If you have a lot of custom elements - such as CSS stylesheets or JS files - you may need to create blocks for those, or find another way to present the content, like creating Page templates in your (child) theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.