zola icon indicating copy to clipboard operation
zola copied to clipboard

A Clarification of my issue

Open tripleo1 opened this issue 3 years ago • 30 comments

Does zola require one to publish in the root of the server? I have multiple blogs I would like to host under one domain name.

See #1497

tripleo1 avatar Jun 03 '21 16:06 tripleo1

It shouldn't

Keats avatar Jun 05 '21 07:06 Keats

Does zola require one to publish in the root of the server? I have multiple blogs I would like to host under one domain name.

Nope, just make sure to configure your web server properly. In Apache, it means that you set the DocumentRoot variable in your site's virtual host declaration to wherever the web root should be.

(cc @Keats— this should be closable)

doamatto avatar Jun 14 '21 05:06 doamatto

I'm using Github Pages (without the TLD option).

I'm also using path in the front matter.

Maybe this is the solution I'm looking for, but it seems doubtful.

tripleo1 avatar Jun 15 '21 23:06 tripleo1

In theory, if you use seperate folders for each site, you'd be fine. You can change the base_url variable to reflect wherever you are on a site (eg. tripleo1.github.io/sitea or tripeo1.github.io/siteb, et al)

doamatto avatar Jun 16 '21 03:06 doamatto

Right, that's in my config.toml, but all links are still being generated in complete ignorance of this.

tripleo1 avatar Jun 16 '21 05:06 tripleo1

Make sure your base_url has http(s) otherwise it will generate relative links.

all links are still being generated in complete ignorance of this.

In zola build or zola serve? It's normal for zola serve to override the links

Keats avatar Jun 16 '21 07:06 Keats

In zola build or zola serve? It's normal for zola serve to override the links

That does remind me to make sure that you are using zola build. zola serve won't work with GitHub Pages; rather you need to build the site with something like Travis or GitHub Actions.

doamatto avatar Jun 16 '21 14:06 doamatto

I use zola serve to edit locally, and I use https://github.com/shalzz/zola-deploy-action to deploy to github pages. Works like a charm except for the issue I'm describing.

And I am using https in base_url. zola serve indeed ignores the base url.

tripleo1 avatar Jun 17 '21 04:06 tripleo1

Which url does it use?

Keats avatar Jun 17 '21 09:06 Keats

The deploy-action makes all links relative to root. I would expect (as I'm guessing you all are describing) that this would use the base_url, but it doesn't.

And zola serve makes all links relative to root.

tripleo1 avatar Jun 20 '21 08:06 tripleo1

The deploy-action makes all links relative to root. I would expect (as I'm guessing you all are describing) that this would use the base_url, but it doesn't.

I'm a bit confused, in zola build all links by Zola are prefixed with the base_url. It does not inspect random links in HTML or Markdown to prefix them though.

Keats avatar Jun 24 '21 20:06 Keats

I just tried a zola build on my local machine and it doesn't generate links prefixed by base_url, so the plugin is not to blame, which I thought at first.

Are there any requirements of base_url, because mine is prefixed by https://.

tripleo1 avatar Jun 25 '21 02:06 tripleo1

Can you show an example of links not being prefixed? Where it's defined etc

Keats avatar Jun 25 '21 08:06 Keats

The last line in this file, for example:

https://raw.githubusercontent.com/elijah-team/programming-with-elijah/main/blog/content/edition-2/posts/01-freestanding-rust-binary/index.md

which points to

https://elijah-team.github.io/programming-with-elijah/namespaces-and-packages/

But only after massaging with command line tools.

Note that I am using paths in the front matter. Could this be the source?

tripleo1 avatar Jun 29 '21 08:06 tripleo1

The first link is a 404 for me

Keats avatar Jun 29 '21 09:06 Keats

Sorry, I did some reorganization

Here

https://raw.githubusercontent.com/elijah-team/programming-with-elijah/main/blog/content/edition-2/posts/01-organizing-classes/index.md

That just shows @/path/.../xyz.md

tripleo1 avatar Jun 29 '21 14:06 tripleo1

I took the file on an empty new zola project and it seems to work for me? I'm using the next branch so it might be in some bug already fixed?

Keats avatar Jun 29 '21 20:06 Keats

Try to build the whole project with next. It fails.

Failed to build the site
Error: invalid type: sequence, expected a map for key `languages` at line 37 column 1

tripleo1 avatar Jul 03 '21 14:07 tripleo1

The config has been changed for the next version for languages since there are now more language specific options. See https://github.com/getzola/zola/blob/next/test_site_i18n/config.toml#L19-L27 for an example of the new way to define them.

Keats avatar Jul 03 '21 18:07 Keats

Thanks for your help.

What about this one:

Error: invalid type: map, expected a string for key `translations.en`

I searched the website and the repository sample sites and didn't find anything.

tripleo1 avatar Jul 22 '21 06:07 tripleo1

Translations are now nested on their language definitions: https://github.com/getzola/zola/blob/next/components/config/src/config/mod.rs#L501-L511

Keats avatar Jul 22 '21 07:07 Keats

I'm having a hard time using the translations in a template.

How would you render description dynamically in this case?

[translations]
description = "Une description"

[languages.en]
[languages.en.translations]
description = "A description"

This does not work:

<meta name="description" content="{{config.languages[lang].description}}" />

Error:

Variable `config.languages[lang].description` not found in context while rendering 'page.html': the evaluated version was `config.languages.en.description`. Maybe the index is out of bounds?

snadon avatar Jul 22 '21 17:07 snadon

Config are now language aware in the templates, so you just need to do config.translations.description

Keats avatar Jul 22 '21 17:07 Keats

The new error:

Reason: Failed to render 'page.html' (error happened in 'index.html').
Reason: Variable `config.translations.description` not found in context while rendering 'page.html'

snadon avatar Jul 22 '21 17:07 snadon

Sorry, I forgot the translations are not passed to the templates. You have to use https://www.getzola.org/documentation/templates/overview/#trans

Keats avatar Jul 22 '21 17:07 Keats

Translations are now nested on their language definitions: https://github.com/getzola/zola/blob/next/components/config/src/config/mod.rs#L501-L511

I think this should be documented, unless I missed that when reading the documentation site. I was breaking my head trying to figure this out until I stumbled upon this issue. Also this documentation page https://www.getzola.org/documentation/content/multilingual/ seems to be outdated.

Yaroslav-95 avatar Aug 31 '21 14:08 Yaroslav-95

Ah damn I forgot this needed updating as well.

Keats avatar Sep 01 '21 10:09 Keats

On 8/31/21 10:36 AM, Yaroslav wrote:

Translations are now nested on their language definitions:
https://github.com/getzola/zola/blob/next/components/config/src/config/mod.rs#L501-L511
<https://github.com/getzola/zola/blob/next/components/config/src/config/mod.rs#L501-L511>

I think this should be documented, unless I missed that when reading the documentation site. I was breaking my head trying to figure this out until I stumbled upon this issue. Also this documentation page https://www.getzola.org/documentation/content/multilingual/ https://www.getzola.org/documentation/content/multilingual/ seems to be outdated.

So what exactly is the syntax? (And where does it go?)

I've been meaning to ask this for weeks but just never got around to it...

tripleo1 avatar Sep 03 '21 08:09 tripleo1

On 21/09/03 01:12AM, tripleo1 wrote:

So what exactly is the syntax? (And where does it go?)

I've been meaning to ask this for weeks but just never got around to it... You can take look at my website's config.toml if it's of any help: https://git.yaroslavps.com/yaroslavps.com/tree/config.toml

Yaroslav-95 avatar Sep 03 '21 09:09 Yaroslav-95

https://www.getzola.org/documentation/content/multilingual/ has been updated

Keats avatar Sep 04 '21 06:09 Keats