An open API service indexing awesome lists of open source software.

https://github.com/flexchar/chemija-org

2.0 Version
https://github.com/flexchar/chemija-org

Last synced: 6 months ago
JSON representation

2.0 Version

Awesome Lists containing this project

README

          

# Chemija.org Archive

This repository contains the source code for the Chemija.org website, a chemistry resource site in Lithuanian. It is a monorepo built with Astro for the frontend and Sanity as a headless CMS.

## Project Structure

The monorepo is organized into three main directories:

1. **`astro-app/`**: The frontend application built with [Astro](https://astro.build/).
* **`src/`**: Contains the core source code.
* `assets/`: Static assets like CSS.
* `components/`: Reusable Astro components, including UI elements, interactive calculators (e.g., molar mass, chemical equation balancer), and components for rendering rich text content from Sanity.
* `layouts/`: Defines the overall page structure.
* `pages/`: Defines the routes and individual pages of the site (e.g., homepage, articles, exams, calculators).
* `types/`: TypeScript type definitions, including those generated from the Sanity schema.
* `utils/`: Utility functions, notably `sanity.ts` which handles fetching data from Sanity using GROQ queries.
* `public/`: Static files publicly accessible (e.g., images, `robots.txt`).
* `astro.config.mjs`: Astro configuration file.
* `vercel.json`: Configuration file for Vercel deployment, generated by a script in the `misc/` directory. This file includes redirects from legacy URLs and rewrite rules for a fallback to an older version of the site.

2. **`studio/`**: The [Sanity Studio](https://www.sanity.io/studio) configuration for content management.
* **`src/schemaTypes/`**: Defines the content model (schemas) for Sanity.
* `documents/`: Defines the main content types:
* `article.ts`: For chemistry articles, including rich text body, categories, and legacy URL tracking.
* `category.ts`: For categorizing articles.
* `exam.ts`: For past chemistry exams, including question and answer files.
* `questionnaire.ts`: For sets of questions and answers ("Klausimynas").
* `objects/`: Defines reusable structured content types that can be embedded within documents:
* `blockContent.tsx`: A rich text editor schema allowing various formatting options, lists, and embedding of images, YouTube videos, and tables. This is where the "ugly content" mentioned in the problem description might originate if not structured well by content editors.
* `table.ts`: For creating simple tables.
* `youtube.ts`: For embedding YouTube videos.
* `sanity.config.ts`: Main configuration file for the Sanity Studio.
* `sanity.cli.ts`: Configuration for the Sanity CLI.

3. **`misc/`**: Contains miscellaneous scripts and utility files.
* **`scripts/generate-vercel-config.ts`**: A crucial script (run with Bun) that generates the `vercel.json` file for the `astro-app/`. It fetches articles with legacy URLs from Sanity and creates permanent redirects to their new slugs. It also includes global redirects and a rewrite rule to proxy unmatched paths to a legacy Netlify site (`chemija-legacy.netlify.app`), facilitating a gradual migration.

## Content Management

Content for the website is managed in Sanity Studio. The "ugly content" issue likely refers to content within the `blockContent` fields of articles that may lack consistent structure or formatting. Improving this would involve either migrating/cleaning up existing Sanity data or providing stricter guidelines and tools for content editors.

## Development

(Information about local development setup, if available, would go here. Typically involves running the Astro dev server and the Sanity Studio locally.)

## Deployment

The Astro application is deployed on Vercel. The `misc/scripts/generate-vercel-config.ts` script plays an important role in configuring redirects and rewrites for the Vercel deployment.