https://github.com/gravity-ui/blog-constructor
https://github.com/gravity-ui/blog-constructor
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gravity-ui/blog-constructor
- Owner: gravity-ui
- License: mit
- Created: 2022-12-30T10:42:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-14T10:34:05.000Z (over 1 year ago)
- Last Synced: 2025-01-14T11:37:11.555Z (over 1 year ago)
- Language: TypeScript
- Size: 12.6 MB
- Stars: 13
- Watchers: 1
- Forks: 2
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# @gravity-ui/blog-constructor · [](https://www.npmjs.com/package/@gravity-ui/blog-constructor) [](https://github.com/gravity-ui/blog-constructor/actions/workflows/ci.yml?query=branch:main) [](https://github.com/gravity-ui/blog-constructor/actions/workflows/release.yml?query=branch:main) [](https://preview.gravity-ui.com/blog-constructor/)
## Install
```shell
npm install @gravity-ui/blog-constructor
```
## Blog-constructor
`Blog-constructor` is a library based on the [Page-constructor](https://github.com/gravity-ui/page-constructor) library for creating blog format web pages. Blog-constructor uses the [`custom`](https://github.com/gravity-ui/page-constructor#custom-blocks) prop from page-constructor to add the components needed for the blog.
### Documentation - [storybook](https://preview.gravity-ui.com/blog-constructor/)
### Getting started
The blog-constructor has both client components and server components for import. The blog pages is imported as a React component. To make sure it runs properly, wrap it in `BlogConstructorProvider`:
```jsx
import {BlogPage, BlogConstructorProvider} from '@gravity-ui/blog-constructor';
// Main blog page
---
import {BlogPostPage, BlogConstructorProvider} from '@gravity-ui/blog-constructor';
// Post page
```
Documentation about [providerProps](./src/constructor/README.md).
Also blog-constructor have server components to help you transform your data if you need
```jsx
import {
transformPost,
sanitizeMeta,
createReadableContent,
transformPageContent,
} from '@gravity-ui/blog-constructor/server';
```
The `blog-constructor` is a `uikit-based` library, and we use an instance of `i18n` from uikit. To set up internationalization, you just need to use the `configure` from uikit:
```typescript
import {configure} from '@gravity-ui/uikit';
configure({
lang: 'ru',
});
```
## Development
```bash
npm ci
npm run dev
```