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

[i18n_subsites] STATIC_PATHS copied multiple times #180

Closed
Scheirle opened this issue Mar 26, 2014 · 7 comments
Closed

[i18n_subsites] STATIC_PATHS copied multiple times #180

Scheirle opened this issue Mar 26, 2014 · 7 comments
Assignees

Comments

@Scheirle
Copy link
Member

All files and folders in the STATIC_PATHS variable are copied in each subsite.

This is a huge problem if you have large files in it.

It would be better to just copy it once, but therefore correct the links in the subsites.

@smartass101
Copy link
Contributor

Hi, thank you for pointing this out.
There is a way to fix this, but the thing is that some people may put the output in a different OUTPUT_PATH for each lang.
Maybe I should add some setting for this functionality? like I18N_COPY_STATIC=False by default

@smartass101
Copy link
Contributor

Actually a simple fix is to set STATIC_PATHS to [] in the I18N_SUBSITES overrides dict for each language that you don't want to copy them. If this fixes your problem, you can close the issue :)

@Scheirle
Copy link
Member Author

The problem with overwriting STATIC_PATHS in I18N_SUBSITES is that it isn't possible anymore to create an internal link to the content in STATIC_PATHS.

Btw the static folder of the theme(s) should also be considered.

@smartass101
Copy link
Contributor

I think this would require something like the move_translations_links function for all elements of the staticfiles list in the context. Therefore, I think we should first try to redesign that function as per #182 and then use it for static files.

@smartass101
Copy link
Contributor

I was looking into this and I don't see a solution. All the intrasite links are made relative to the current SITEURL as is THEME_STATIC_DIR in templates. Moreover, if we enable the user to specify an arbitrary SITEURL and OUTPUT_PATH as requested in #180, I simply don't see a reliable way to "link back" to the top site that would work for everyone. In a particular case it could be solved by overriding STATIC_PATHS and THEME_STATIC_DIR and then adding some special filters in templates.

@Scheirle
Copy link
Member Author

Scheirle commented May 2, 2014

@smartass101 I have code which should solve this problem. It still uses the old design (runnig pelican multiple times), but maybe it will help.

I didn't posted this earlier because I am not pleased with it.

Changes in Scheirle@0f574ad:

  • Change the SITEURL for every pelican run (appanding the language)
  • Move the output and url for all static files
    • The exclude of EXTRA PATH METADATA only is a proof of concept
    • Note the use of the update_generator_contents_static signal

@smartass101
Copy link
Contributor

Doing something like that would be possible of course, but as I said before, it won't work with arbitrary SITEURL and OUTPUT_PATH settings.

@smartass101 smartass101 self-assigned this May 11, 2014
smartass101 added a commit to smartass101/pelican-plugins that referenced this issue Nov 2, 2014
Major highlights
................
- fixed and improved cross-linking (fixes getpelican#333) with URLs
  containing e.g. localized month names
  (thanks to issue getpelican/pelican#1198)
- support for custom ``SITEURL`` and ``OUTPUT_PATH`` hierarchy
  (fixes getpelican#182)
- sharing of static files (including those of the theme) among
  subsites (fixes getpelican#180)

Technical highlights
....................
- added a test suite (works with pelican 3.4)
- translations are installed into Jinja2 environments of all
  generators
- old locale is restored after generation, fixes autoreload

The documentation has been updated and improved (mostly in terms of
formatting).

Known issues
............
- due to the redesign required for correct cross-linking, older
  versions of Pelican (<3.4) are not supported, because they lack
  certain signals
- the ``HIDE_UNTRANSLATED_CONTENT`` setting has been deprecated in
  favor of the ``I18N_UNTRANSLATED_{ARTICLES,PAGES}`` settings which
  offer more control in order to fix getpelican#211.
- the test suite works only with pelican 3.4, later versions add a
  timezone field to the date
calfzhou pushed a commit to calfzhou/pelican-plugins that referenced this issue Sep 28, 2019
rschiang pushed a commit to rschiang/pelican-i18n-subsites that referenced this issue Aug 9, 2022
Major highlights
................
- fixed and improved cross-linking (fixes getpelican/pelican-plugins#333) with URLs
  containing e.g. localized month names
  (thanks to issue getpelican/pelicangetpelican/pelican-plugins#1198)
- support for custom ``SITEURL`` and ``OUTPUT_PATH`` hierarchy
  (fixes getpelican/pelican-plugins#182)
- sharing of static files (including those of the theme) among
  subsites (fixes getpelican/pelican-plugins#180)

Technical highlights
....................
- added a test suite (works with pelican 3.4)
- translations are installed into Jinja2 environments of all
  generators
- old locale is restored after generation, fixes autoreload

The documentation has been updated and improved (mostly in terms of
formatting).

Known issues
............
- due to the redesign required for correct cross-linking, older
  versions of Pelican (<3.4) are not supported, because they lack
  certain signals
- the ``HIDE_UNTRANSLATED_CONTENT`` setting has been deprecated in
  favor of the ``I18N_UNTRANSLATED_{ARTICLES,PAGES}`` settings which
  offer more control in order to fix getpelican/pelican-plugins#211.
- the test suite works only with pelican 3.4, later versions add a
  timezone field to the date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants