static blog generator written in PHP with the powerful of Laravel blade template engine.
Lina is an opinionated flat-file CMS for who want a simple and fast blog. Lina uses Blade template engine, so you can use all Blade features.
- Blazing fast: Lina is a lightweight and superfast static blog generator.
- Written in PHP: so if you hate Javascript, Lina is for you.
- Blade template engine: you can use all Blade features.'
- Minimalistic: Lina is a static blog generator. It's not a full-fledged CMS.
- Deploy everywhere! You know, just html files 🤣
- PHP 8.3
There are some ways to install Lina:
Require Lina as dependency, with this option, you can keep lina up-to-date easily.
mkdir my-blog && cd my-blog && composer init --name=linaphp/blog --no-interaction --require=bangnokia/lina:^0.5 && composer install
./vendor/bin/lina new . # scaffolding a new blog skeleton in the current directory
./vendor/bin/lina serve # start a development server and happy writing
Or install Lina as global composer package
composer global require linaphp/lina
lina new my-blog
lina serve
Or you can use the phar
file
curl -LO https://github.com/linaphp/lina/releases/latest/download/lina.phar && chmod +x lina.phar
In case you want to migrate from another blog platform, you can check the base structure of Lina
content/
posts/
2020-11-01-hello.md
index.md
resources/
views/
index.blade.php
post.blade.php
public/
images/
style.css
content
directory is where you store your markdown content file.resources/views
directory is where you store your blade template.public
directory is where you store your assets like images, css, ... This folder is also where all the generated files are stored. So please remember to add your custom files to.gitignore
if you want to store them ingit
We really recommend you to prefix your content file with the date, so it will easy to sort and find your content. Lina automatically strip the date from the slug, so you don't need to worry about the url.
There are some functions that you can use to programmatically access your content.
Get all the content in a directory. The content will be sorted by the date in the filename.
foreach (lina()->index('post') as $post) {
echo $post->title;
}
$post = lina()->get('posts/2020-11-01-hello.md');
Lina can be deployed to any static hosting provider. Here are some examples: Github pages, Netlify, Vercel, Cloudflare pages, ...
So you please modify the file .github/workflows/deploy.yml
to match your demand.
We also provide a configuration file for Cloudflare pages. You can find it in cloudflare-page.sh
. You can modify it to
match your demand.
Also you need to change the Build configuration
like this.
So, you know, at least that's me.
- daudau.cc: My personal blog. Source code.
- Lina's landing page: Lina's site (this site is built with Lina, of course). Source code.
from https://github.com/linaphp/lina
-----
Why write lina?
The thing is, I have a lot of free time these days, I'm thinking of writing something random. Of course, just simple things like markdown are enough, no need to setup wordpress or anything. I also looked at Jekyll, this guy generates content into static html files and can be used with github pages, so convenient . Reading the doc, I see that it uses liquid template and is built with ruby. I don't know ruby, and I find it difficult to read using this liquid template engine, and it's probably not as good as laravel's blade template engine, so I also searched through some guys but found that there were many functions that I didn't need. So I built my own for ease of use. Initial idea {#idea} After consulting jekyll -> this is also why I named it pekyll (jekyll in php) , I think these functions are enough: parse markdown file build htmls file and deploy to github page use blade of laravel What I like most about blade in recent versions of laravel is the support for view components, and I want to be able to use anonymous components (https://laravel.com/docs/master/blade#anonymous-components) in lina. Implementation {#implementation} Actually, the idea is simple so there is no need to elaborately write from scratch, installing packages of all kinds is almost enough to support the functions.
No comments:
Post a Comment