Giter Site home page Giter Site logo

Can servus work with org-mode? about servus HOT 13 OPEN

sch1z00 avatar sch1z00 commented on July 23, 2024
Can servus work with org-mode?

from servus.

Comments (13)

ibz avatar ibz commented on July 23, 2024 1

I think the admin interface will not work locally. I have never tried it in this way.

But what you are trying is a very good use-case indeed.

I'll have a look to make everything smoother for running it locally, because it totally makes sense - whether for use with org-mode or simply for having a tool for local note-keeping, that can eventually be synced with other non-local instances.

from servus.

ibz avatar ibz commented on July 23, 2024

Would you mind posting the command you are using to run Servus and the filesystem structure (the output of find sites) so I can try to replicate the issue?

To me it seems you are missing an "index", because that is what would be rendered if you access "/". Basically you would need a file named _content/pages/index.md.

This is what I have...

$ cat sites/ibz.me/_content/pages/index.md 
---
title: ''
---

Welcome to {{ site.title }}!

from servus.

ibz avatar ibz commented on July 23, 2024

BTW, you will also need to populate _layouts. That is done automatically if you create a site using the admin interface or the REST API, but if you do it manually, you'll need to add some layouts there.

Here is what needs to be present in a site directory, at a very minimum: https://github.com/servuscms/servus/tree/master/themes/default - besides the _config.toml!

from servus.

sch1z00 avatar sch1z00 commented on July 23, 2024

tihs is my command

~/bin/servus $ ./target/debug/servus 
Found site: schizo
Loading layouts...
Loaded 4 templates!
Scanning file ./sites/schizo/_content/pages/posts.md...
Resource: url=/posts.
Scanning file ./sites/schizo/_content/pages/index.md...
Resource: url=/index.
Site loaded!
1 sites loaded!
tide::server Server listening on http://0.0.0.0:4884

and this is the output when I try to browse http://0.0.0.0:4884

tide::log::middleware <-- Request received
    method GET
    path /
tide::log::middleware Client error --> Response sent
    method GET
    path /
    status 404 - Not Found

from servus.

ibz avatar ibz commented on July 23, 2024

TL/DR: This will solve your problem: mv sites/schizo sites/0.0.0.0:4884.

The reason is that the way to determine what site to serve (you can have multiple) is using the hostname - or, in this case, of running it locally, it is simply the ip:port - so you need to name your site the same as what you will be using to access it.

I agree that for this simple case of running it locally (and/or of having only one site) it is counter-intuitive. I'll come up with some better way for this case, But for now, the above solution should work.

from servus.

sch1z00 avatar sch1z00 commented on July 23, 2024

now it seems to work, but I've this error

tide::log::middleware <-- Request received
    method GET
    path /
thread 'async-std/runtime' panicked at src/site.rs:417:37:
called `Result::unwrap()` on an `Err` value: Error { kind: Msg("Failed to render 'page.html' (error happened in 'base.html')."), source: Some(Error { kind: Msg("Variable `site.tagline` not found in context while rendering 'page.html'"), source: None }) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I guess it's a configuration problem, so I tried to create a site using the admin interface, but I didn't understand how to do it.

If, for example, I run

./target/debug/servus --admin-domain 0.0.0.0

and I browse http://0.0.0.0:4884/api/sites
I got

tide::log::middleware <-- Request received
     method GET
     path /api/sites
tide::log::middleware Client error --> Response sent
     method GET
     path /api/sites
     status 400 - Bad Request

from servus.

ibz avatar ibz commented on July 23, 2024

Edit your _config.toml and set tagline = "something" under the [site] section. That will pass site.tagline to the layout.

from servus.

sch1z00 avatar sch1z00 commented on July 23, 2024

It works!
I thought there might be other configuration problems and therefore having to use the administration interface, but now it's already fine. Now I need to figure out how to use org-capture to populate the site's directories with the correct md files...

Thank you

from servus.

ibz avatar ibz commented on July 23, 2024

I think you will encounter one more issue if you do that: you add .md files, but Servus doesn't know about them because it only checks for new files on start. The only way (currently) to add posts when it is running is to post via the Nostr protocol. But I am thinking to make it such that it somehow finds the new files while already running.

from servus.

sch1z00 avatar sch1z00 commented on July 23, 2024

Even if I restart servous it scans the new md files but does not publish them (both in pages and in posts)... in any case I await the new changes you will be able to make... Thanks for your work

from servus.

ibz avatar ibz commented on July 23, 2024

If you are able to restart it from org-mode, then it should work. On start, it scans all files and they are automatically published! If that doesn't work, let me know...

from servus.

sch1z00 avatar sch1z00 commented on July 23, 2024

I do not know how to do; If I do I'll let you know

from servus.

sch1z00 avatar sch1z00 commented on July 23, 2024

Now I need to figure out how to use org-capture to populate the site's directories with the correct md files...

DONE exporting org file through pandoc.el (I export titles, dates, etc.)

Now I need to obtain an ssl cert; I've tried your suggestions, with "ssl-acme" option and using "acme.sh", without success

from servus.

Related Issues (10)

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.