Code Monkey home page Code Monkey logo

hugojoomla's Introduction

Joomla to Hugo conversion tool.

Converts a joomla database into a series of md markup files in the TOML format suitable for use in Hugo content manager [http://hugo.go.io]

This conversion utility will change any URLs that are in Joomla internal format into joomla SEO friendly format (assuming you had SEO friendly links on before converting). If you did not have SEO friendly links turned on, your conversion will not be automatic, as you will have to map all the Joomla URLS.

HTML Joomla articles are converted to markdown with the https://github.com/furstenheim/copy-down to ensure compatibility with hugo > 6.0 which is not rendering HTML content by default anymore.

Hugo Joomla is tested by converting an older Joomla 3 site I had from Joomla to Hugo. With the latest release, I believe it should be fully functional for most people. My blog [https://www.thecoderscorner.com] is an example of a site converted with this utility.

There is a more detailed article on my website that may be helpful before starting: [https://www.thecoderscorner.com/team-blog/joomla-cms/moving-to-hugo-from-joomla/].

In order to use this utility you will need to move any statically served content (images, media, etc) into the Hugo static directory before proceeding, keep the same directory structure as you had on Joomla. At this point I recommend that you check carefully there are no compromised PHP files in that structure before copying!

At the moment this project always converts all nested categories into menus in the front matter, there are examples of this both on the Hugo site [https://gohugo.io/extras/menus/] and also there is an example at this site (https://github.com/vjeantet/hugo-menu-show).

If you used nested categories, you'll probably have to make changes to the template to support it. Otherwise, you probably just need to remove the reference to the root category in the top level categories and away you go!

In addition all content is currently converted as type "blog".

Running the conversion utility

Check that you have at least Java 8 installed. You can check your java version using the following command:

java --version

The above command should return something like:

java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)

I have tested that the process at least runs on Java versions through to 16.

You can use the packaged version that is available from the releases page. releases page

Change into the application directory and run the command as follows:

java -jar .\hugo-joomla-0.1-SNAPSHOT.jar -dburl <url> -dbuser <user> -dbpass <password> -outdir <dir> -dbext <prefix>

** WARNING: !!this process will overwrite all existing files with the same names. Ensure you have a backup before running!!**

Where

  • dburl is the jdbc URL. Example "jdbc:mysql://localhost:3306/your_dbname". For local connection on 3306 to your_dbname
  • dbuser is a user that can read from the database
  • dbpass is the password for the user
  • outdir optional, defaults to current dir. Where to write the content files.
  • dbext the extension used for joomla tables in the db. Eg: tcc would be tcc_tablename
  • buildtags optional, defaults to true. Turn on or off processing of tags.
  • htmltomarkdown optional, defaults to true. Turn on or off HTML article content conversion to markdown.

Building from source

Pull down the master branch from this github project in order to start. You will also need apache maven, any recent version should be good enough. Ensure the maven bin directory is on your path. At this point in the project top level directory type:

mvn install

Once this is complete there will be a target directory, and in there will be a jar file.

Deveopers and notes on contributing

Please raise a PR with the change. Check https://github.com/joomlaext/hugojoomla/actions/runs/1177286827 for CI pipeline result before merging ;-)

For particularly large scale changes, it's best to raise an issue first.

hugojoomla's People

Contributors

davetcc avatar matt6697 avatar rimas-kudelis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hugojoomla's Issues

Numerous warnings about not processed images

2018-06-02 22:03:21 WARN  JoomlaContent:47 - Images for 1 not processed
Unexpected token END OF FILE at position 0.
        at org.json.simple.parser.JSONParser.parse(JSONParser.java:257)
        at org.json.simple.parser.JSONParser.parse(JSONParser.java:81)
        at org.json.simple.parser.JSONParser.parse(JSONParser.java:75)
        at com.thecoderscorner.web.hugojoomla.JoomlaImage.<init>(JoomlaImage.java:22)
        at com.thecoderscorner.web.hugojoomla.JoomlaContent.<init>(JoomlaContent.java:44)
        at com.thecoderscorner.web.hugojoomla.JoomlaHugoConverter.lambda$performConversion$2(JoomlaHugoConverter.java:107)
        at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93)
        at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:60)
        at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:463)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:408)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:474)
        at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:484)
        at com.thecoderscorner.web.hugojoomla.JoomlaHugoConverter.performConversion(JoomlaHugoConverter.java:96)
        at com.thecoderscorner.web.hugojoomla.HugoJoomla.main(HugoJoomla.java:35)

introImage = new JoomlaImage("intro", images);

Is it worth making a jpackage package for this?

This would allow people to run it standalone, without needing to install a JDK or anything on Linux, Windows and MacOS. I build these about once or twice a quarter for an Arduino Menu Framework that I look after. I could do this next time around if there was interest.

The thing is this is a bit of a one-off tool and I'm not sure people would really want to install it, but if others think there's value I'll do it next time I do the release.

The log should end with a mention of warnings if they occured

I just noticed the conversion process logs a lot of warnings. This is not visible from the last few lines that imply a success with no mention of warnings:

Finished conversion of Joomla database

I would at least expect a hint that warnings occured and should be checked in the conversion log (prior log messages).

Prepackaged version unavailable

You write in documentation:

"You can use the packaged version that is available from the releases page. Building from source is not required."

There is no releases page. I do not like to install the big maven suite only to try hugojoomla...

Michal

Disregard of character encoding

It seems like the export does not respect the utf-8 character encoding. After conversion the md files contain invalid characters.

My website is in utf-8, my database default collation is utf8_general_ci, although most content tables seem to be collation utf8mb4_unicode_ci.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.