{"id":18561266,"url":"https://github.com/apostrophecms/blog","last_synced_at":"2025-04-10T03:30:36.173Z","repository":{"id":59906498,"uuid":"537071291","full_name":"apostrophecms/blog","owner":"apostrophecms","description":"An ApostropheCMS bundle for managing and browsing blog articles","archived":false,"fork":false,"pushed_at":"2025-03-28T11:59:46.000Z","size":86,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T05:30:03.213Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apostrophecms.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-15T14:44:00.000Z","updated_at":"2025-03-27T13:49:01.000Z","dependencies_parsed_at":"2023-02-17T06:40:24.710Z","dependency_job_id":"64e590d2-4ffe-4ac4-ace8-9f2e79461ae0","html_url":"https://github.com/apostrophecms/blog","commit_stats":{"total_commits":18,"total_committers":6,"mean_commits":3.0,"dds":0.5555555555555556,"last_synced_commit":"7997c65c20da7f88a79fe15b2b8a5fb50d6af423"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fblog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fblog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fblog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostrophecms%2Fblog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apostrophecms","download_url":"https://codeload.github.com/apostrophecms/blog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248150677,"owners_count":21055965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T22:06:23.156Z","updated_at":"2025-04-10T03:30:35.568Z","avatar_url":"https://github.com/apostrophecms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/apostrophecms/apostrophe/main/logo.svg\" alt=\"ApostropheCMS logo\" width=\"80\" height=\"80\"\u003e\n\n  \u003ch1\u003eApostrophe Blog\u003c/h1\u003e\n  \u003cp\u003e\n    \u003ca aria-label=\"Apostrophe logo\" href=\"https://docs.apostrophecms.org\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/MADE%20FOR%20ApostropheCMS-000000.svg?style=for-the-badge\u0026logo=Apostrophe\u0026labelColor=6516dd\"\u003e\n    \u003c/a\u003e\n    \u003ca aria-label=\"Join the community on Discord\" href=\"http://chat.apostrophecms.org\"\u003e\n      \u003cimg alt=\"\" src=\"https://img.shields.io/discord/517772094482677790?color=5865f2\u0026label=Join%20the%20Discord\u0026logo=discord\u0026logoColor=fff\u0026labelColor=000\u0026style=for-the-badge\u0026logoWidth=20\"\u003e\n    \u003c/a\u003e\n    \u003ca aria-label=\"License\" href=\"https://github.com/apostrophecms/blog/blob/main/LICENSE.md\"\u003e\n      \u003cimg alt=\"\" src=\"https://img.shields.io/static/v1?style=for-the-badge\u0026labelColor=000000\u0026label=License\u0026message=MIT\u0026color=3DA639\"\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\nThis module bundle helps developers quickly add blog articles to ApostropheCMS websites. It provides the blog post piece type (`@apostrophecms/blog`) as well as a special page type (`@apostrophecms/blog-page`) for editors to create a blog.\n\n## Installation\n\nTo install the module, use the command line to run this command in an Apostrophe project's root directory:\n\n```\nnpm install @apostrophecms/blog\n```\n\n## Usage\n\nConfigure the blog modules in the `app.js` file:\n\n```javascript\nrequire('apostrophe')({\n  shortName: 'my-project',\n  // Activate the bundle\n  bundles: [ '@apostrophecms/blog' ],\n  modules: {\n    // The main blog piece type module\n    '@apostrophecms/blog': {},\n    // The blog page module\n    '@apostrophecms/blog-page': {}\n  }\n});\n```\n\n### Enable the page type\n\nTo enable the blog page type for editor to select, add it to the `@apostrophecms/page` configuration:\n\n```javascript\n// modules/@apostrophecms/page/index.js\nmodule.exports = {\n  options: {\n    types: [\n      {\n        name: '@apostrophecms/home-page',\n        label: 'Home'\n      },\n      // Adding the blog page type\n      {\n        name: '@apostrophecms/blog-page',\n        label: 'Blog Page'\n      }\n    ]\n  }\n};\n```\n\n**Note:** The index page template (`index.html`), filters template partial (`filters.html`), and show page template (`show.html`) are primarily meant as a starting point for a project. They demonstrate much of the available template data, but developers will almost always want to override them to implement proper styles and layout.\n\n### Filtering by year, month, and day\n\nThe default field `publishedAt` (\"Publication Date\" in the UI) sets the publication date of the blog post. By default, only articles released in the past are displayed to the user. In the Apostrophe admin UI, all articles are shown to the editors and admin.\n\n\u003e This doesn't mean that Apostrophe will automatically publish a draft update to an existing post on this date. To schedule the publication of new draft content, consider installing the optional [@apostrophecms/scheduled-publishing](https://github.com/apostrophecms/scheduled-publishing) module.\n\nThe blog page module, `@apostrophecms/blog-page`, provides query filters to refine blog results by year, month, and day. These are primarily used for index page filters (see the `filters.html` file), but can also be used in REST API requests and server-side queries.\n\n| Filter Name | Description          | Expected Format |\n| ----------- | -------------------- | --------------- |\n| `year`      | Filter by blog year  | `YYYY`          |\n| `month`     | Filter by blog month | `YYYY-MM`       |\n| `day`       | Filter by blog day   | `YYYY-MM-DD`    |\n\n### Multiple blog piece types\n\nSometimes a website needs multiple, distinct types of blog posts. If the blog posts types can be managed together, it might be easiest to [add a new field](https://docs.apostrophecms.org/guide/content-schema.html#using-existing-field-groups) and [query builder](https://docs.apostrophecms.org/reference/module-api/module-overview.html#queries-self-query) to customize blog views. But if the blog posts types should be managed completely separately, it may be better to create separate piece types for each.\n\nJust as we [extend `@apostrophecms/piece-type`](https://docs.apostrophecms.org/guide/pieces.html#creating-a-piece-type) to create a new piece type, we can extend `@apostrophecms/blog` to create a new blog post type. The blog post type will need its own module directory and UI labels. It can simply inherit the original fields, and other configuration or override them in the blog type's `index.js` file.\n\nA special blog post type that has a blog URL field might look like this:\n\n```javascript\n// modules/special-blog/index.js\nmodule.exports = {\n  extend: '@apostrophecms/blog',\n  options: {\n    label: 'Special blog post',\n    pluralLabel: 'Special blog posts'\n  },\n  fields: {\n    add: {\n      blogUrl: {\n        label: 'blog post URL',\n        type: 'url'\n      }\n    },\n    group: {\n      basics: { fields: ['blogUrl'] }\n    }\n  }\n};\n```\n\nAs always with piece-page types and piece types, you must have a module extending `@apostrophecms/blog-page` that corresponds to each module extending `@apostrophecms/blog`. Apostrophe will match them up based on the naming convention.\n\n```javascript\n// modules/special-blog-page/index.js\nmodule.exports = {\n  extend: '@apostrophecms/blog-page'\n};\n```\n\nDo this as many times as you need custom blog types. Adding filtering and new fields to the base blog module is usually enough for most use cases, but organizations with more complex blog needs will find this strategy helpful.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fblog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapostrophecms%2Fblog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostrophecms%2Fblog/lists"}