Giter Site home page Giter Site logo

Comments (11)

smartass101 avatar smartass101 commented on August 21, 2024

Thank you for your fix, will commit it later and will use this approach also for other settings.

from pelican-plugins.

Scheirle avatar Scheirle commented on August 21, 2024

Hm, this fix breaks the feeds. They still point to the old url.

You get: example.com/posts/article.html instead of example.com/en/posts/article.html

from pelican-plugins.

Scheirle avatar Scheirle commented on August 21, 2024

Nope. I did the thing for the SITEURL. The problem is if HIDE_UNTRANSLATED_CONTENT is False and you are currently generating the english site (therefore SITEURL= 'example.com/en/), the german articles generate this url example.com/en/de/posts/....
While generating a subsite the english articles generate example.com/de/../posts/....

from pelican-plugins.

smartass101 avatar smartass101 commented on August 21, 2024

I think the culprit here is the move_translations_links function. It needs to do something more sophisticated when you arbitrarily change the settings as it expects the layout I used. Perhaps urllib.parse would have to be used to unparse the source and target destinations and modify them accordingly. I think I did try something like that in the beginning but gave up, because using the simple default layout seemed much simpler and less error prone. I think the difference between absolute URLs and relative ones was the main problem.

Maybe you'll be more lucky :) I'm looking forward to your implementation of the function. I might have a look at it later.

from pelican-plugins.

smartass101 avatar smartass101 commented on August 21, 2024

Here is a rough idea of the redesign of the plugin, needs the get_writer signal from getpelican/pelican#1330 though.

Process:

  1. Let pelican run up to get_writer signal, then run pelican for next subsite, in each run save each generator in some global dict and remove translations (in pretaxonomy if available) but save the relationships to translations (Content.source_path being the "primary key" in this relational db)
  2. recurse until last language subsite, then assign for each content assign to content.translations the translated content from the generators in the subsites where the translations are not perceived as translations (i.e. not removed from the main content list)
  3. then finally write everything

from pelican-plugins.

smartass101 avatar smartass101 commented on August 21, 2024

I've made a first concept, but the problem is that all URLs used internally by Pelican are always relative to the current SITEURL, so specifying arbitrary SITEURL would require very ugly hacks within Pelican an templates.

Therefore, I propose that this plugin would enable to specify arbitrary SITEURL overides that would get appended to the main site SITEURL, enabling a custom hierarchy using ../. E.g. the layout decribed above could be achived using something like

SITEURL = 'http://example.com/en'
I18N_SUBSITES = {
'de': { 'SITEURL' : '../de' }
}

OUTPUT_PATH could be theoretically completely arbitrary, but by default it would also just get the SITEURL override appended.

If this design is accepted, the site and subsites would have some hierarchal structure and #180 could be implemented using ../ pointers.

@Scheirle, what do you think?

from pelican-plugins.

Scheirle avatar Scheirle commented on August 21, 2024

@smartass101 I think appending the SITEURL is fine but maybe it will confuse some new users.

Also the plugin should simplify the SITEURL after the concatenation (http://example.com/en/../de becomes http://example.com/de/) so that not every URL on a subsite looks strange.

from pelican-plugins.

smartass101 avatar smartass101 commented on August 21, 2024

@Scheirle, I agree that appending SITEURL is a bit confusing, but do you know of some simpler way to enforce some processable hierarchy within the different SITEURLs? What I would be ok with would be if there would be some simple way to parse the different SITEURLs and determine their hierarchy and warn if the hierarchy is inconsistent.

Simplifying them after concatenation should be easy thanks to posix.normpath when applied to the path part of the URL.

from pelican-plugins.

smartass101 avatar smartass101 commented on August 21, 2024

@ingwinlu was so kind and provided a nice way to find the distance of the paths in https://gist.github.com/ingwinlu/20615105bba903ccf0d8, will see if I can use that.

from pelican-plugins.

smartass101 avatar smartass101 commented on August 21, 2024

@saimn was so kind and also provided a solution in https://dpaste.de/7CY4

from pelican-plugins.

smartass101 avatar smartass101 commented on August 21, 2024

@spiroid, please don't ask for support in issues that may not have anything to do with your problem. I suggest you come to the #pelican IRC channel and ask for help there. And the description you provided is so vague that nobody can help you, so be prepared to give a concrete example on IRC.

from pelican-plugins.

Related Issues (20)

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.