GithubHelp home page GithubHelp logo

nhymxu / tramkho-blog-engine Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 5.21 MB

Dead simple blog engine

License: BSD 3-Clause "New" or "Revised" License

PHP 22.63% HTML 2.37% Twig 13.56% CSS 36.97% JavaScript 24.48%
blog-engine php slimphp hacktoberfest

tramkho-blog-engine's Introduction

blog

Dead simple blog engine

tramkho-blog-engine's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

tramkho-blog-engine's Issues

opengraph meta data

Current

<meta name="description" content="">
<meta property="og:type" content="website">
<meta property="og:title" content="">
<meta property="og:url" content="">
<meta property="og:site_name" content="Dz notes">
<meta property="og:description" content="">

Need filled data to this

add `X-Response-Time` header

Sample code:

<?php
declare(strict_types = 1);

namespace Middlewares;

use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

class ResponseTime implements MiddlewareInterface
{
    const HEADER = 'X-Response-Time';

    /**
     * Process a server request and return a response.
     */
    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $server = $request->getServerParams();
        $startTime = $server['REQUEST_TIME_FLOAT'] ?? microtime(true);
        $response = $handler->handle($request);

        return $response->withHeader(self::HEADER, sprintf('%2.3fms', (microtime(true) - $startTime) * 1000));
    }
}

Need add as first middleware

Project page

List all project

Have some detail

  • Title
  • Screenshot
  • Description
  • Link

Maybe create simple table on database

Init project

Very simple blog engine.

  • Data store on SQLite
  • Caching render to html file, some part on redis
  • Language maybe Python/PHP
  • Need tool convert from WordPress
  • Validation using rakit/validation
  • Dependency Injection using php-di/php-di
  • Add hashtag to footer of post
  • Tag page - list all post via tag
  • Maybe default hide insideme tag from index
  • Re-validate post content
  • Split database to 2 file: tech blog and insideme blog
  • Tag list page: show all tag have on system ( maybe count number of post for each tag )
  • Better config
  • Analytics: GA, self-tracked

Add config file to quick enable debug function

Currently, when I want to debug, I need add multi line to this .env.php file

define('NX_DEBUG', true);

$settings['error']['display_error_details'] = true;
$settings['error']['log_errors'] = true;
$settings['error']['log_error_details'] = true;

$settings['logger']['level'] = \Monolog\Logger::DEBUG;

$settings['twig']['options']['debug'] = true;
$settings['twig']['options']['cache_enabled'] = false;

I want create seperate file, put all of settings to this file.
When I need debug, just import this file.

Maybe can put on docs/ folder with name env.debug.php

and modify .env.php like this

<?php

require __DIR__ . '/docs/env.debug.php';

allow config to get post tag on post list or not

Currently, homepage and tag list page only get simple post detail.
I want get tag for each post. But not fixed (base on each theme).

So I want add config $settings['homepage']['get_post_tag'] = false; to know when I need to get tags for each post.

choose layout render post

Each post have layout properties on metadata. When render post, choose template to render based on this properties

[FEAT]: youtube embed

Description

I need embed youtube video to post.

So I think syntax maybe:

[youtube_embed](https://www.youtube.com/watch?v={video_id_here})

If markdown parser match youtube_embed keyword and check link is youtube video
=> create youtube embed frame over clickable-link

Additional Information

We need customize how markdown lib parsing document.

caching htmt output to static file

Because blog post not change frequently, so I want caching this to static html file on cache folder.

Apache or Nginx can direct access this cache file over php process + database query.

It's good for frontend

So I need

  • Middleware write output content to file
  • Document for nginx config

Comment system

  • Show comment list on post detail
  • Visitor can post comment
    • Verify login using google account

:bug: error when update published time

public function updatePostPublishTime(int $post_id, string $publish_time)
{
$sql = "UPDATE post
SET published_at = :publish_time
WHERE id = :post_id AND published_at = ''";
$stmt = $this->connection->prepare($sql);
$stmt->execute([
'post_id' => $post_id,
'published_at' => $publish_time
]);
}

On this function, wrong param name make publish post action always error.

Just changed from 'published_at' => $publish_time to 'publish_time' => $publish_time

Preload anonymous font

Replace @css import with html preload

<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Anonymous+Pro&display=swap" rel="stylesheet">

and

font-family: 'Anonymous Pro', monospace;

add health-check route

Need health check url for validate.

Maybe:

/status
/health
/ping

Response can be pong only or json with many value want to check

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.