Comments (11)
Thank you for your fix, will commit it later and will use this approach also for other settings.
from pelican-plugins.
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.
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.
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.
Here is a rough idea of the redesign of the plugin, needs the get_writer
signal from getpelican/pelican#1330 though.
Process:
- 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) - 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) - then finally write everything
from pelican-plugins.
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.
@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.
@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 SITEURL
s? What I would be ok with would be if there would be some simple way to parse the different SITEURL
s 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.
@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.
@saimn was so kind and also provided a solution in https://dpaste.de/7CY4
from pelican-plugins.
@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)
- [md_inline_extension] Broken with Markdown >= 3.4
- Asking to move some plugins in the Pelican plugin repo HOT 14
- [github_activity] Readme.rst has wrong reference to library used by plugin
- An alternate presentation of pelican-plugins and legacy plugins repos
- [org_python_reader] TRANSLATION property is not respected
- [New Plugins] spellcheck, uniquotes, redirects
- [New plugin] reStructuredText footnotes
- [Migration] - Readtime HOT 1
- [migration] asciidoc_reader HOT 5
- [migration] headerid HOT 1
- [New Plugin] Pelican-Injector: A plugin to inject code into specific HTML tags in pages and articles HOT 4
- [migration] representative_image HOT 5
- I18N Subsites: Use translation for default site not for subsite
- Transition to PYPI's Trusted Publisher mechanism
- New plugin
- feature request(headerid): Markdown support HOT 1
- Docutils has no localization for 'eu HOT 1
- [asciidoc_reader] Issue with detecting available binaries
- For requirements.txt, use PDM, PIP, Conda or pipreqs? HOT 2
- Strava Routes Page Injection Plugin
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pelican-plugins.