anomaly/posts-module
最新稳定版本:v2.7.0
Composer 安装命令:
composer require anomaly/posts-module
包简介
A versatile articles and posts manager.
README 文档
README
anomaly.module.posts
A versatile articles and posts manager.
The Posts Module provides a flexible blogging and article management system with categories, tags, and multiple post types.
Features
- Post management
- Category organization
- Tag support
- Multiple post types
- Draft & scheduling
- Featured posts
- RSS feeds
- SEO optimization
Usage
Accessing Posts
use Anomaly\PostsModule\Post\Contract\PostRepositoryInterface; $posts = app(PostRepositoryInterface::class); // Get all posts $allPosts = $posts->all(); // Get published posts $published = $posts->findAllPublished(); // Get post by slug $post = $posts->findBySlug('my-article'); // Get posts by category $posts = $posts->findByCategory($category);
In Twig
{# List posts #} {% for post in posts().published().get() %} <article> <h2><a href="{{ post.path }}">{{ post.title }}</a></h2> <p>{{ post.summary }}</p> <time>{{ post.publish_at|date('F j, Y') }}</time> </article> {% endfor %} {# Display single post #} <article> <h1>{{ post.title }}</h1> <time>{{ post.publish_at|date('F j, Y') }}</time> <div>{{ post.content|raw }}</div> {# Categories & Tags #} {% for category in post.categories %} <span>{{ category.name }}</span> {% endfor %} {% for tag in post.tags %} <span>{{ tag.name }}</span> {% endfor %} </article> {# Recent posts #} {% for post in posts().published().orderBy('publish_at', 'desc').limit(5).get() %} <a href="{{ post.path }}">{{ post.title }}</a> {% endfor %}
Categories & Tags
{# All categories #} {% for category in categories().get() %} <a href="{{ url_route('anomaly.module.posts::category', [category.slug]) }}"> {{ category.name }} </a> {% endfor %} {# All tags #} {% for tag in tags().get() %} <a href="{{ url_route('anomaly.module.posts::tag', [tag.slug]) }}"> {{ tag.name }} </a> {% endfor %}
Requirements
- Streams Platform ^1.10
- PyroCMS 3.10+
License
The Posts Module is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 44.82k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-16