定制 swiftmade/blogdown 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

swiftmade/blogdown

最新稳定版本:v6.0.0

Composer 安装命令:

composer require swiftmade/blogdown

包简介

Simple Laravel blog package using markdown

README 文档

README

This project is no longer maintained. This repository has been archived and is no longer accepting issues or pull requests. Feel free to fork if you'd like to continue development.

Add a simple, flat-file markdown blog to your existing Laravel application.

Latest Version on Packagist Total Downloads GitHub Actions StandWithUkraine

Install

You can install the package via composer:

# Require it as a dependency
composer require swiftmade/blogdown

# Publish the config file
php artisan vendor:publish --provider "Swiftmade\Blogdown\BlogdownProvider"

Go to config/blogdown.php to configure authors (example included in the file).

Post generator

Simply run this command to make a new article:

php artisan blog:new

Follow the instructions, and you'll have your first blog post ready in seconds.

Anatomy of a post

Each post consists of a meta section (mandatory) and the content. You can use Markdown to enrich your post's format.

To use markdown inside blade, simply invoke @markdown / @endmarkdown. Or, you can also add .md extension before .blade.php and skip the markdown calls.

{{--
title: Hello World!
tags: blog, first post
date: 18.03.2020
--}}
Use blade to compose post content.

@markdown
**Or even use markdown** if you want.

### Isn't that great?
@endmarkdown

Draft vs Published

Let's say you're working on a long post and it's not production ready yet. Just do this:

{{--
... other attributes
draft: true
--}}

... Your awesome content ...

Since you added the draft meta attribute, this post will be hidden in production environments.

Meta Attributes are Dynamic

You can declare as many meta attributes as you want.

{{--
random_attribute: 51231
--}}

You can access your post's meta attributes like so:

$post->random_attribute; // 51231

Force Clear Cache

php artisan blog:index

Customizing Blogdown

You can change most things about Blogdown. To get started, publish the config:

php artisan vendor:publish  --provider "Swiftmade\Blogdown\BlogdownProvider"

Things you can customize

  • Override views to change how your blog looks
  • Add list of authors to quickly load author meta
  • Format and content of post slugs
  • Enable/disable default routes.
  • Change date format.
  • And probably more...

Format and content of post slugs

By default, this is how a post's slug is built:

public function slug()
{
    return Str::slug($this->view_name);
}

If needed, you can override the Post model and build a better slug:

public function slug()
{
    return Str::slug($this->date->format('Y-m-d') . ' ' . $this->title);
}

Don't forget to register your custom Post model in config/blogdown.php!

Contributors

统计信息

  • 总下载量: 1.65k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 22
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 4
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固