Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[convert-jekyll] permalink conversion refinement #374

Closed
Geobert opened this issue Jan 28, 2018 · 13 comments
Closed

[convert-jekyll] permalink conversion refinement #374

Geobert opened this issue Jan 28, 2018 · 13 comments

Comments

@Geobert
Copy link
Contributor

Geobert commented Jan 28, 2018

While working on migrating my blog from WP to Cobalt through Jekyll, I've used 2 different WP plugin to export to Jekyll:

wp_exporter produce this kind of frontmatter:

---
id: 3494
title: Scary Pockets
date: 2017-05-03T20:55:07+00:00
author: Geobert
layout: post
guid: http://geobert.fr/?p=3494
permalink: /2017/05/03/scary-pockets/
categories:
  - Non classé
tags:
  - funk
  - musique
  - pomplamoose
---

exit_wp:

---
author: geob
comments: true
date: 2017-05-03 19:55:07+00:00
layout: post
link: https://haurchefant.fr/2017/05/03/scary-pockets/
slug: scary-pockets
title: Scary Pockets
wordpress_id: 3494
categories:
- Non classé
tags:
- funk
- musique
- pomplamoose
---

wp_exporter produce a more Jekyll compatible front, but it has a bug that delete some links (youtube links in my example).

So I used exit_wp that keep all the content properly, but the front lack of permalink.

Another issue is that both front ends their permalink with a slash instead of .html, which makes cobalt try to generate /permalink/index.html instead of /permalink.html.

So maybe we can improve the converter by providing some options:

  • provide some regex to define how to parse the permalink attr, so we can say which field we need to convert into permalink, and how (like dropping the base url my example)
  • make sure that no trailing slash remains and add extension .html
  • or even drop the permalink completely
@epage
Copy link
Member

epage commented Jan 29, 2018

Another issue is that both front ends their permalink with a slash instead of .html, which makes cobalt try to generate /permalink/index.html instead of /permalink.html.

To confirm, you want the permalink permalink: /2017/05/03/scary-pockets/ to generate a page at 2017/05/03/scary-pockets.html instead of 2017/05/03/scary-pockets/index.html?

If thats the case, that sounds like a bug in your exporter rather than a jekyll thing because Jekyll also creates "pretty URLs". So if you are wanting it done against how Jekyll works, we'll probably want to split this out from jekyll's conversion to a WP export-specific conversion.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 29, 2018

Oh I see. In my use case, I need to drop the permalink altogether. Maybe some configuration/option to choose what we want to keep in the front?

@epage
Copy link
Member

epage commented Jan 29, 2018

Is the reason to drop the permalink specific to you or your conversion?

Why do you want to drop it?

@Geobert
Copy link
Contributor Author

Geobert commented Jan 29, 2018

I've check on my WP blog and all the url are like the value converted into Jekyll, so the converter is right. I want to drop it because I want all my generated files flattened into one directory. I guess this is not a job for cobalt but some external scripts?

@epage
Copy link
Member

epage commented Jan 29, 2018

Options

  • Make the converter "correct" but then hack it up for your personal needs.
  • Make the converter "correct" and create another crate that uses cobalt_model to load and modify the files

t because I want all my generated files flattened into one directory. I guess this is not a job for cobalt but some external scripts?

While having them flat is nice, having them without ".html" is nicer. I've embraced the pretty URLs on my site.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 29, 2018

Why that? To have them sorted in subdirs?

@epage
Copy link
Member

epage commented Jan 29, 2018

It looks nicer when you're URL doesn't have an extension

For example: https://epage.github.io/about/

@Geobert
Copy link
Contributor Author

Geobert commented Jan 29, 2018

hm… true :)

Ok, so let give up the whole flattened stuff!

But I still need something to transform the link: field into a permalink.
Maybe contacting the author of exit_wp, but the project seems dead. Or hack it myself…

@epage
Copy link
Member

epage commented Jan 29, 2018

RE link:

I could see us having a hack in our covnerter to try this if permalink is missing. Or we can separate it off in a distinct wp import.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 29, 2018

The thing is that if we go the import WP route, we need to process the WP export format (a huge XML file).

@epage
Copy link
Member

epage commented Jan 29, 2018

I meant the jekyll export from wp but imprting from the XML directly is also reasonable. I plan to eventually implement that for evernote.

@Geobert
Copy link
Contributor Author

Geobert commented Jan 29, 2018

directly from WP's xml… hm why not, I'll think about it, will avoid having some pseudo Jekyll file as input for Jekyll convertor.

@epage
Copy link
Member

epage commented Aug 31, 2018

Closing in favor of cobalt-org/cobalt-migrate-jekyll#3

@epage epage closed this as completed Aug 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants