Giter Site home page Giter Site logo

Comments (21)

ibz avatar ibz commented on June 7, 2024 1

This happens because your site servus.page doesn't match the URL in your browser. Rename your site to default, in which case it will work regardless of the URL.

from servus.

ibz avatar ibz commented on June 7, 2024 1

Yes, themes is the next thing to come, after I standardize, freeze and document the variables passed to the templates.

I want to decouple the functionality from the themes, so one will be able to change themes at any time while keeping content intact.

What I have now is a proof-of-concept that works well enough for me, but in order for it to work for others, it really needs themes. Nobody sane tweaks CSS by hand just to have a website. Should be able to pick a theme and go.

from servus.

ibz avatar ibz commented on June 7, 2024

Whoops, I renamed some stuff here and there, notably page.date should be page.published_at - forgot to rename these in the default site I generate.

from servus.

georgkaser avatar georgkaser commented on June 7, 2024

Okay - now Error { kind: Msg("Variable page.meta.title not found in context while rendering 'post.html

from servus.

ibz avatar ibz commented on June 7, 2024

Also I changed the structure quite a bit, no more hidden folder, , so yes, _config.toml is in the site directory now. I figured, after all, that Jekyll didn't do a bad job at defining a structure, and I can stay with that as much as possible, if not just for simplicity of migration...

from servus.

ibz avatar ibz commented on June 7, 2024

page.meta.title

page.front_matter.title

Though I think I will change it again and just have it page.title - but for now everything that comes from the front matter is under .front_matter.

from servus.

georgkaser avatar georgkaser commented on June 7, 2024

Hehehe, okay, so I better wait until you changed that?

Now I am at

$ ./target/debug/servus dev
Found site: servus.page
Loading layouts...
Loaded 3 templates!
Loaded post /posts/servus from ./sites/servus.page/_posts/2022-12-30-servus.md
Loaded page /index from ./sites/servus.page/index.md
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Msg("Failed to render '__tera_one_off'"), source: Some(Error { kind: Msg("Variable `post.meta.title` not found in context while rendering '__tera_one_off'"), source: None }) }', src/main.rs:1013:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

from servus.

ibz avatar ibz commented on June 7, 2024

Rename post.meta.title to page.front_matter.title and it should move on to the next error... :-/

from servus.

ibz avatar ibz commented on June 7, 2024

Hehehe, okay, so I better wait until you changed that?

Depends what you are up to. This is still very experimental, although I do use it to run 2 live sites with it already, but I keep tweaking it... I should just better document the variables passed to the templates, and then stick with it, at least between major versions or something, but I am still trying out stuff. :)

from servus.

georgkaser avatar georgkaser commented on June 7, 2024

I would love to see it run - your solution to generate static pages from nostr is really a great idea.

Now I did a folder search/replace. Result:

$ ./target/debug/servus dev
Found site: servus.page
Loading layouts...
Loaded 3 templates!
Loaded post /posts/servus from ./sites/servus.page/_posts/2022-12-30-servus.md
Loaded page /index from ./sites/servus.page/index.md
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Msg("Failed to render '__tera_one_off'"), source: Some(Error { kind: Msg("Variable `page.front_matter.title` not found in context while rendering '__tera_one_off'"), source: None }) }', src/main.rs:1013:40
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

😂

from servus.

georgkaser avatar georgkaser commented on June 7, 2024

It seems that I changed everything on the right places - I managed it to get it run. BUT: When I call the Address in my Browser, I got this response:

image

$ ./target/debug/servus dev
Found site: servus.page
Loading layouts...
Loaded 3 templates!
Loaded post /posts/servus from ./sites/servus.page/_posts/2022-12-30-servus.md
Loaded page /index from ./sites/servus.page/index.md
Loaded page /posts from ./sites/servus.page/posts.md
Loaded resource /atom.xml from ./sites/servus.page/atom.xml (application/xml;charset=utf-8 bytes=615)
Loaded resource /sitemap.xml from ./sites/servus.page/sitemap.xml (application/xml;charset=utf-8 bytes=525)
Loaded resource /robots.txt from ./sites/servus.page/robots.txt (text/plain;charset=utf-8 bytes=55)
Open http://localhost:4884 in your browser!
tide::server Server listening on http://0.0.0.0:4884
tide::log::middleware <-- Request received
    method GET
    path /
thread 'async-std/runtime' panicked at 'no entry found for key', src/main.rs:98:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Do you know why? I added my public key in the _config.toml:

pubkey = "6ee9299b9b688748e187f92a5ac02208108ffe4dfc8c669e86dc16485acde8d5"

from servus.

georgkaser avatar georgkaser commented on June 7, 2024

You are right, it works now. But my demo posts from nostr will not shown - do I need some extra work to do except to add the pubkey? Or will it only work via https?

from servus.

ibz avatar ibz commented on June 7, 2024

How are you posting to Nostr? You need to use a NIP-23 compatible client, such as habla.news, add your Servus instance as a relay, and post. If you post to other relays, you won't see the posts.

from servus.

georgkaser avatar georgkaser commented on June 7, 2024

I did this one on habla.news: https://habla.news/a/naddr1qqxnzd3cxy6rqvp3xyer2dejqys8wumn8ghj7mn0wd68ytn9d9h82mny0fmkzmn6d9njuumsv93k2tcppemhxue69uhkummn9ekx7mp0qythwumn8ghj7un9d3shjtnwdaehgu3wvfskuep0qgsxa6ffnwdk3p6guxrlj2j6cq3qsyy0lexlerrxn6rdc9jgttx734grqsqqqa28t4ec2v

from servus.

ibz avatar ibz commented on June 7, 2024

What relays did you post to? Did you post to your Servus instance? Note that you can configure the relays you want to post to in Habla.

from servus.

georgkaser avatar georgkaser commented on June 7, 2024

Oh, no - I didn't know yet that I am able to use this as a relay. I'am working locally on my laptop - so I need to put it into live mode that ist reachable from outside and after that I post again to this address? Is there some documentation about this fantastic feature?

from servus.

ibz avatar ibz commented on June 7, 2024

It only works as a relay. That is what it is - a personal relay where you post, it keeps your posts forever, and generates a website.

You should be able to test locally, open habla.news and set your local address as a relay. Habla runs in your browser, so it doesn't need to be reachable from the outside. You could even set some hostname in /etc/hosts so you can access it by hostname rather than by IP. The only downside with testing locally is that it can't obtain the SSL certificates from Let's Encrypt - you would need to run it on a VPS first to get the certificates, but after that you can use these certificates to test locally using Habla and with your host in /etc/hosts.

from servus.

georgkaser avatar georgkaser commented on June 7, 2024

oooookay :D I was thinking that it takes my posts from nostr and makes some static website of it. But this is even better... Maybe you should change your description a little bit to explain the relay function.

I tried now (locally and via the ip address from my router with open port on my router), with open port on my laptop via iptables. No luck. There are also no debug messages:

image

UPDATE: some more information:

image

Maybe it's my browser (Ungoogled Chrome). I will try standard Firefox. One moment... :D

from servus.

ibz avatar ibz commented on June 7, 2024

image

I thought this was pretty clear. But hey, I should probably explain in more detail how it works.

The fact that you are going through these steps now actually really helps, since I at least know what issues others face. For me it just works, because I know where to look if it doesn't, but I am the only user so far.

I think the issue is...

Habla is served over https://, therefore it will try to open a wss:// connection rather than a ws:// connection. And a wss:// connection is impossible without the certificates.

I did play with it locally and with Habla, but I did the /etc/hosts trick and copied over the certificates from my VPS.

So I guess you are out of luck at this point, unless you can spin up a VPS and run the executable there in "live" mode, so it will get SSL certificates.

from servus.

georgkaser avatar georgkaser commented on June 7, 2024

Hehe, yes - you know, I am an old school web developer (PHP, MySQL etc.) - I read this, but even I need a little bit more explanation :))

But, no problem - I will try it with an subdomain but maybe not today. I WANT TO GET THIS THING TO WORK :)))

If it's working, I can nerve you even more - after that I will try to develop a nice theme we can share with others if you want. I will have a lot of questions I think.

You will hear from me - is it okay to contact you on nostr? I follow you now there...

from servus.

ibz avatar ibz commented on June 7, 2024

OK, so I:

  1. got rid of .front_matter and just flattened everything under page (so use page.title rather than page.front_matter.title)
  2. renamed published_at to date

(these are for simplicity and more consistency with Jekyll templates)

  1. documented the variables passed to the templates (see README)
  2. moved the default site that is generated if no sites are found under themes/blank (now we could in theory have additional themes under themes/)
  3. fixed the "blank theme" to use the correct template variables - works on the first run now, if no sites are found, a site using the "blank" theme is generated, and it works

from servus.

Related Issues (8)

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.