Git Product home page Git Product logo

crosspub's Introduction

crosspub

A tool for users on tilde servers to cross publish blog posts to HTML and Gemini.

Installation

Cargo

cargo install crosspub

Binary

Linux binaries are available on the Releases page

From source

Run

make
sudo make install

Usage

crosspub is designed to not need any configuration out of the box. To start create a containing directory and initialize it.

mkdir website
crosspub --init

This creates two directories, one for posts (blogs and articles written on a specific day) and one for topics (evolving documents that change and grow over time), as well as creating a default config file.

crosspub content is written in gemtext, a lightweight markup language. Files should end in .gmi.

Next, change the settings in your config.toml, see Basic Configuration.

Create posts directories in your HTML and Gemini root directories

mkdir ~/public_html/posts
mkdir ~/public_gemini/posts

Change these paths to match your configuration.

When you're ready to generate your website just navigate to the directory you initialized and run

crosspub

Posts syntax

All gemtext files in posts/ must start with a mandatory TOML frontmatter

---
title = "Example Title"
date = "YYYY-MM-DD"
slug = "example"
---

Content goes here
...

The "slug" is a small string that becomes part of the filename, basically a shortened title.

Topics syntax

Files in topics/ start with a slightly different frontmatter that lacks a date field.

---
title = "Example Topic"
slug = "example_topic"
---

...

Basic Configuration

The config file is located at $HOME/.config/crosspub/config.toml

  • name is the title of your site
  • url is the base URL of the site (not including the tilde part)
  • username is your username, your tilde extension on the site minus the ~ character
  • html_root and gemini_root are the paths to your public_html and public_gemini files.

About files

crosspub allows you to write a bio and have it generate an About page. First make sure you have a directory for crosspub data:

mkdir -p ~/.local/share/crosspub

Next create a file in that directory called about.gmi. This is just a plain gemtext file, no frontmatter.

Finally edit ~/.config/crosspub/config.toml so that use_about_page = true

Advanced Configuration

Custom Templates

If desired, more unique sites can be created by utilizing custom templates. First create the proper directories

mkdir -p ~/.local/share/crosspub/templates/html
mkdir -p ~/.local/share/crosspub/templates/gemini

The default templates are located at /usr/share/crosspub/templates/. It is recommended to look at the built-in templates for an explanation of how they work.

crosspub uses 5 templates each for HTML and Gemini

  • index
  • post
  • topic
  • postlist
  • about

Some or all of these templates can be shadowed by ones located in ~/.local/share/crosspub/templates.

Custom CSS

Similar to the templates, site-wide CSS can be modified. User CSS should go in ~/.local/share/crosspub/templates/html/style.css

Post Listing

The default index.html and index.gmi templates both list posts on the homepage. If you'd like to move this listing to a separate page set post_list = true in your config. This creates a listing at {HTML_ROOT}/posts/posts.html and {GEMINI_ROOT}/posts/posts.gmi. crosspub will NOT automatically link to these listings, so it's up to you to modify other templates as necessary.

crosspub's People

Contributors

genericlastname avatar jkbest2 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jkbest2 serxoz

crosspub's Issues

preformated text

Hi!
There's something weird going on with the preformatted text. When I write:
3 backticks (i write this like that because github rendering...)
line 1
line 2
3 backticks

the html is rendered as:
<pre>line1line2</pre>
no line breaks :/

Thank you in advance!

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.