WordPress.org

Ready to get started?Download WordPress

Forums

HTML Import 2
[resolved] How do I keep the existing slugs? (16 posts)

  1. SocialBlogsite
    Member
    Posted 2 years ago #

    Taking the page slug from the post name is frivolous since it can be changed later easily, but since SEO rules, keeping the SAME slug is essential to speed-up the process of the conversion to make it live quickly.

    e.g. for a page named Title of Page, whose filename is the-page-name.html

    yoursite.com/blog/title-of-page is not bad, but it's rather costmetic.

    yoursite.com/blog/the-page-name is a MUST.

    Then your rule can be only one, a generic one, redirecting not-found pages with their matching version without ".html"

    How do I get that? I can edit the plugin if needed. I just need to know what line to hack it up at.

    Thanks.

    http://wordpress.org/extend/plugins/import-html-pages/

  2. Mark Tuttle
    Member
    Posted 2 years ago #

    I'm not the plugin author, but I believe the HTML_Import class in html-importer.php defines a method get_post that reads the file and creates the page. This class builds up a WordPress post object in the array $my_post, without explicitly specifying the slug, and then inserts the post into the database with the lines

    if ($updatepost) {
      $my_post['ID'] = $post_id;
      wp_update_post( $my_post );
    }
    else // insert new post
      $post_id = wp_insert_post($my_post);

    I believe these functions wp_update_post and wp_insert_post generate the slug from the title when the slug is not specified. So if you know how to compute the slug you want to use, then setting the slug to $slug should be as easy as adding

    $my_post['post_name'] = $slug;

    before the post insertion code.

  3. Stephanie Leary
    Member
    Plugin Author

    Posted 2 years ago #

    Exactly right, Mark. I've had several requests for this feature, and I'll try to include it in a future version.

  4. SocialBlogsite
    Member
    Posted 2 years ago #

    Thanks Stephanie.
    Also, I'll post another request in a different topic, considering an HTML often comes with a re-design and all the images will need a new width.

  5. espo74
    Member
    Posted 2 years ago #

    ok...this confused me. will this help keep my old and ugly file names to be the same as they used to be?
    uglylongfilename.php vs /ugly-long-file-name/?

    From an SEO perspective am I going to hurt my site by importing the pages and renaming them to the WP standard or am I not going lose good rankings by changing from ugly file name to the WP default?

  6. rudy3107
    Member
    Posted 1 year ago #

    SILLYbean any update on your statement....?

    we are still waiting for the features to keep original SLUGs.

  7. Stephanie Leary
    Member
    Plugin Author

    Posted 1 year ago #

    This feature will be in the next version of the plugin.

  8. rudy3107
    Member
    Posted 1 year ago #

    Now the question is.....

    WHEN next version will be OUT....!

    if its delayed i may finish my project HARD way.

    anyway thank you for the update.

  9. Stephanie Leary
    Member
    Plugin Author

    Posted 1 year ago #

    You can download the development version and give the new option ("preserve slugs"). It should show up as version 2.3a.

  10. rudy3107
    Member
    Posted 1 year ago #

    aha... its ready.

    Thank you Stephanie....

    i will do BETA testing.... and let you know.

  11. rudy3107
    Member
    Posted 1 year ago #

    i cannt see the option "preserve slugs"

    where is this option ?

    under Files/Content/Title/MEta/Category/Tools ?

  12. Stephanie Leary
    Member
    Plugin Author

    Posted 1 year ago #

    No, it's under the first tab, "Files."

  13. rudy3107
    Member
    Posted 1 year ago #

    its not there.
    i reinstalled after manually deleting from phpmyadmin

    there are only 5 options
    //Directory to import
    old site URL
    Default file
    File extensions
    directories to include

    Its added in html-importer.php file but not in html-import-options.php.

    may be you are missing something

  14. Stephanie Leary
    Member
    Plugin Author

    Posted 1 year ago #

    Yes, the file for the options page didn't get updated. Try downloading a fresh copy; it should be there now. Sorry about that!

  15. rudy3107
    Member
    Posted 1 year ago #

    THANK YOU Stephanie;

    it worked. i imported 1615 pages in one shot.

    but it rename main page slug as long Title page name.htm as well as sundirectory index page name as its Title page slug.

    if you donot want to include TITLE, it will take page id number instead its original page slug.

    if same slug exists in different directories it will add slug name and -1.htm (eg: slug-1.htm, slug-2.htm)

    thats what i found out so far, i will update if anything more

    THANK YOU VERY MUCH.

  16. Stephanie Leary
    Member
    Plugin Author

    Posted 1 year ago #

    I've just released 2.3, which includes this feature.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic