lonekorean / wordpress-export-to-markdown

Converts a WordPress export XML file into Markdown files.
MIT License
1.07k stars 216 forks source link

Permalinks are needed #104

Closed bksubhuti closed 6 months ago

bksubhuti commented 6 months ago

After going live, I noticed that google's listings of my website were pointing to the wrong place. I'm not sure about the other wp websites.. but i didn't organize my wp website with date year day etc because they were long links.. so I answered the questions to not do that during export. My pages were always mywebsite.org/mypage/ Everything worked well, but google was not pointing to the right place even though the links looked exactly the same. Because I get 2k referrals per month, it is a big deal that maybe others didn't notice.

With some struggle and last minute worry, gpt+ came through (again) for me. Permalinks by filename was the easiest way. The wp might be using slug but since that didn't get into the conversions, I simply used filename. That will be best to continue my additional pages I create and consistency if I forget to do add slug to the front matter. Originally gpt+ suggested using slug for permalinks. I'd go with filename as the best choice to keep the front matter simple. (It also saved me another script).

[permalinks]
  posts = "/:filename/"
lonekorean commented 6 months ago

The script uses the WP slug as the folder name (or file name, depending on the option you pick in the wizard). Without all the date/month/year stuff, it would be just the slug. But it always uses the slug.

Your code snippet is setting post permalinks to the filename, so if that works and matches the paths you had before, then the slugs must have come through properly.

When the wizard asked Create a folder for each post? did you answer yes? I think most of the time you want to say yes. Looks like the guy in video did. But the fact that you are setting permalinks to :filename makes me wonder if you didn't.

Do you have an example of a working path and a broken path of the same blog post, to compare and see what was different?

bksubhuti commented 6 months ago

I did not choose make separate folder. Perhaps the issue is just documentation or documentation within the prompting. I also used a different fork it seems which might explain my troubles. My website is fine right now. But it took a small panic session to figure out to have permalink to filename. I didn't know what permalink was until that problem arose. I have heard of slug before because i see it in wordpress. It would be good if the script figured out what was being used, and just did it, or figured out what was done in the past and said , this action will preserve your google search referrals or other people's bookmarks to your site. Part of the smooth migration is to match the same url structure, so all old bookmarks or search engine links work the same. I didn't consider that until after I switched on my DNS to HUGO.

I sort of remember it prompted and said that if directories were used, then the picture would be saved in each folder. Now that everything is finished and working (mostly), I am glad that I have all of my images in the static/images folder in a single place.

lonekorean commented 6 months ago

Feedback noted, thank you. Closing this issue since the wizard can already produce the desired directory/filename structure.