I've just started using Drupal. I'm in the process of building my first web site (I'm not a web designer but have a reasonable knowledge of html, css and python and some comprehension of the DOM).

My workflow is to produce content in markdown and then produce html files locally before uploading to my site. I've looked at a few options to try and do this in Drupal but am struggling to make headway.

All I really want to do is grab a bunch of html pages at a time from a folder (in ubuntu linux) and add them in as basic page nodes with the filename as the node title.

I've tried the feed module and import_html and migrate but they all seem to be set up to take a SQL table rather than a simple html table. I don't need anything parsed or mapped other than full text to "content" as full html and file_name to title.

Any help appreciated. This is pretty fundamental to the way I work, and after three days of trying to crack it, I'm stumped.

adding that I have reviewed the following question

How to add multiple HTML nodes in Drupal and viewed the video and followed the link but the former doesn't cover html and my import doesn't show up as a node and the latter has several PHP code fragments and I'm not sure how to bring them together into a single script and where to put that script.

  • Are you sure you need a content management system like Drupal if your workflow requires you to compose HTML outside it? One of the things Drupal is doing is to take markup and render HTMl from it.
    – Mołot
    Sep 1, 2014 at 10:54
  • Hi @Molot, I guess the appeal of a CMS for me was the separation of view from content and the ability to add content on the fly without having to worry about the css and design side, rather than the content creation. Arguably that isn't enough reason, but it sounds like such an appealing concept that I wanted to explore it. Sep 1, 2014 at 11:00
  • My point exactly - you are mixing content data with how it is displayed (it's markup), and you want to continue doing this in Drupal. But Drupal was designed about the exactly opposite idea - content in content, the way it is presented, it's HTML markup, in themes. Now you want to undo that. You are going against the reasoning from your own comment here, it seems.
    – Mołot
    Sep 1, 2014 at 11:05

1 Answer 1


Tahnoon, This is a very unusual task you are trying to perform. Typically we use Drupal to generate new content and manage how that content is displayed. As you have experienced, there are a couple mechanisms in place to import data from databases, spreadsheets, CSVs etc, but not an easy way to import existing HTML files from a specific directory.

What you are trying to do CAN be done but it will take a certain amount of PHP coding [not a whole lot] to write a custom module that would do this.

Since your request is not a common case, you will not find a tutorial for it that exactly meets your needs. Rather, you will have to learn PHP and Drupal Module development techniques and write code to find that directory, parse through each file in it, extract out all of the markup between and and place it in the body field, change the filter to FULL HTML, take the file name and use it for the TITLE.

I can't possibly use StackExchange to teach you all of this, so I'll just get you started. 1] get friendly with http://api.drupal.org this is where we store all of the documentation on the Drupal API 2] specifically look up the hook_menu implementation and create a page where your custom code will fire [for this purpose you're going to hardcode the directory rather than build a user-interface that asks for it.] 3] study up on the family of Drupal file functions. I don't think you'll need any generic PHP file functions, but it could happen. 4] download and install and enable the Examples for Developers module There is one example in there that is FILE related and it saved me A LOT of work last month. 5] You also need to look at the Google results on how to programmatically create nodes http://goo.gl/A3hUP4 there are a few ways to do this.

Those 5 steps should get you where you want to be. Since you're somewhat new to PHP and Drupal this may take a long time, but it will be a tremendously great opportunity to learn!

If you can afford it, you may want to pay someone to build this OR to help you build it so that you learn in the process.

I hope you find this helpful! :-)

  • Hi @dougvann thanks for a great answer. Unless I hear different from other answers I'll mark this accepted in a day or two. Sep 1, 2014 at 11:02
  • Hi @dougvann any suggestions on the best place to hire someone to help build, and teach me how to build it at the same time. I'm n Sep 4, 2014 at 1:01

Your Answer

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

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