commit 383f8bc6673aba959968cca73ca02af9a4c24892 Author: bufferstack Date: Wed Dec 25 02:14:10 2024 -0500 Initial commit diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3787f2e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +# Ignore Astro files +*.astro + +# Ignore node_modules directory +node_modules/ + +# Ignore build output +dist/ \ No newline at end of file diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..03fae14 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,124 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at [satnaingdev@gmail.com](satnaingdev@gmail.com). +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at [this link](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html). + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the [FAQ](https://www.contributor-covenant.org/faq). [Translations](https://www.contributor-covenant.org/translations) are also available. diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..dc8cfa0 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,55 @@ +# How to contribute to AstroPaper + +Thank you for your interest in contributing to **AstroPaper**! We appreciate every contribution, whether you're fixing a typo, improving documentation, or adding a new feature. + +## Types of Contributions + +There are several ways to contribute to **AstroPaper**, and every contribution counts\_ whether it's a PR for a major feature or a small fix. + +You can also contribute by leaving review comments on PRs, adding ideas to existing GitHub Issues and Discussions, or helping others by answering questions in GitHub Discussions. + +Here’s a summary of the different ways you can contribute: + +- [Opening a new issue](#open-a-new-issue) +- [Submitting PRs](#feature-requests) + - [Solving an existing issue](#solving-an-issue) + - [Making changes to a blog post](#making-changes-to-a-blog-post) +- [Helping others by answering issues/discussions](#helping-with-github-issuesdiscussions) +- [Reviewing existing PRs](#reviewing-existing-prs) +- [Starting a discussion](#starting-a-discussion) + +## Open a new Issue + +If you find a bug or problem, first check whether a similar issue already exists. If you don’t find any open issue that addresses the bug/problem you’re facing, feel free to [open a new issue](https://github.com/satnaing/astro-paper/issues/new/choose). + +## Feature Requests + +If you have an idea for a new feature or enhancement that could improve AstroPaper, we’d love to hear it! Before submitting a new feature request, please: + +1. **Check existing discussions/issues**: Review the [Discussions](https://github.com/satnaing/astro-paper/discussions) or [Issues](https://github.com/satnaing/astro-paper/issues) to see if the feature has already been requested or discussed. You can contribute by adding your thoughts or upvoting existing requests. +2. **Open a new issue**: If you don’t find an existing discussion, you can open a new issue using the [Feature Request Template](https://github.com/satnaing/astro-paper/issues/new?assignees=&labels=enhancement&projects=&template=%E2%9C%A8-feature-request.md&title=%5BFeature+Request%5D%3A+). Be as detailed as possible, describing the problem this feature would solve and how it would benefit AstroPaper users. +3. **Discuss first**: If you’re unsure whether your idea is feasible or fits the project’s goals, feel free to [start a GitHub Discussion](https://github.com/satnaing/astro-paper/discussions/new/choose) to gather feedback from the community. + +## Making PRs (Pull Requests) + +### Solving an Issue + +Browse through the existing issues to find one that interests you. You can use labels to filter the issues. See the [Label](https://github.com/satnaing/astro-paper/labels) section for more information. + +### Making Changes to a Blog Post + +For small changes like typos, syntax fixes, or broken links, click the "Suggest Changes" link below the title of any blog post. This will take you to the .md file, where you can make your changes and submit a pull request for review. For more significant changes to a blog post, it’s recommended to open a new issue or discussion first. + +## Helping with GitHub Issues/Discussions + +GitHub Discussions and Issues are great places to help others. Whether you're a long-time user of AstroPaper or just have experience with a specific problem, we encourage you to answer questions or solve issues when possible. + +## Reviewing Existing PRs + +You can help by reviewing and providing feedback on open PRs. Different perspectives can be very helpful. + +Since AstroPaper doesn’t currently have automated testing, it’s especially useful if you can do manual testing on open PRs and provide feedback. + +## Starting a Discussion + +If you’re unsure whether your issue warrants a fix or if you just want to share ideas and get feedback, feel free to [start a GitHub discussion](https://github.com/satnaing/astro-paper/discussions/new/choose). It’s a great way to engage with the community. diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..accbfed --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: [satnaing] +buy_me_a_coffee: satnaing diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..ecfa1bc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: AstroPaper Discussions + url: https://github.com/satnaing/astro-paper/discussions + about: Please ask and answer questions here. diff --git a/.github/ISSUE_TEMPLATE/✨-feature-request.md b/.github/ISSUE_TEMPLATE/✨-feature-request.md new file mode 100644 index 0000000..6d1d669 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/✨-feature-request.md @@ -0,0 +1,19 @@ +--- +name: "✨ Feature Request" +about: Suggest an idea for improving AstroPaper +title: "[Feature Request]: " +labels: enhancement +assignees: "" +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/🐞-bug-report.md b/.github/ISSUE_TEMPLATE/🐞-bug-report.md new file mode 100644 index 0000000..c949bdd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/🐞-bug-report.md @@ -0,0 +1,27 @@ +--- +name: "\U0001F41E Bug report" +about: Report a bug or unexpected behavior in AstroPaper +title: "[BUG]: " +labels: bug +assignees: "" +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/📝-documentation-improvement.md b/.github/ISSUE_TEMPLATE/📝-documentation-improvement.md new file mode 100644 index 0000000..81cdc7a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/📝-documentation-improvement.md @@ -0,0 +1,16 @@ +--- +name: "\U0001F4DD Documentation Improvement" +about: Propose updates or improvements to the documentation/blog posts +title: "[Docs]: " +labels: documentation +assignees: "" +--- + +**Describe the Issue** +A clear and concise description of the documentation issue or improvement. + +**Proposed Changes** +Describe what changes should be made and why they would improve the documentation. + +**Additional Context** +Add any other context or screenshots about the documentation request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..8bf5bad --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,30 @@ +## Description + + + +## Types of changes + + + +- [ ] Bug Fix (non-breaking change which fixes an issue) +- [ ] New Feature (non-breaking change which adds functionality) +- [ ] Documentation Update (if none of the other choices apply) +- [ ] Others (any other types not listed above) + +## Checklist + + + +- [ ] I have read the [Contributing Guide](https://github.com/satnaing/astro-paper/blob/main/.github/CONTRIBUTING.md) +- [ ] I have added the necessary documentation (if appropriate) +- [ ] Breaking Change (fix or feature that would cause existing functionality to not work as expected) + +## Further comments + + + +## Related Issue + + + +Closes: # diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..48e1c6c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: CI + +on: + pull_request: + types: + - opened + - edited + - synchronize + - reopened + workflow_call: + +jobs: + build: + name: Code standards & build + runs-on: ubuntu-latest + timeout-minutes: 3 + + strategy: + matrix: + node-version: [18.x] + + steps: + - name: "☁️ Checkout repository" + uses: actions/checkout@v4 + + - name: "🔧 Setup Node.js ${{ matrix.node-version }}" + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + + - name: "📦 Install dependencies" + run: npm ci + + - name: "🔎 Lint code" + run: npm run lint + + - name: "📝 Checking code format" + run: npm run format:check + + - name: "🚀 Build the project" + run: npm run build diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9a5d91f --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# build output +dist/ +.output/ + +# dependencies +node_modules/ + +# logs +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* + + +# environment variables +.env +.env.production + +# macOS-specific files +.DS_Store + +# ignore .astro directory +.astro + +# yarn +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions +.pnp.* diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..4a9e17a --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,4 @@ +{ + "MD033": false, + "MD013": false +} \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..ef83021 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +# Expose Astro dependencies for `pnpm` users +shamefully-hoist=true diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..f03232f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,13 @@ +# Ignore everything +/* + +# Except these files & folders +!/src +!/public +!/.github +!tsconfig.json +!astro.config.ts +!package.json +!.prettierrc +!eslint.config.mjs +!README.md \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..5d921d9 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,20 @@ +{ + "arrowParens": "avoid", + "semi": true, + "tabWidth": 2, + "printWidth": 80, + "singleQuote": false, + "jsxSingleQuote": false, + "trailingComma": "es5", + "bracketSpacing": true, + "endOfLine": "lf", + "plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"], + "overrides": [ + { + "files": "*.astro", + "options": { + "parser": "astro" + } + } + ] +} diff --git a/AstroPaper-lighthouse-score.svg b/AstroPaper-lighthouse-score.svg new file mode 100644 index 0000000..db86b3d --- /dev/null +++ b/AstroPaper-lighthouse-score.svg @@ -0,0 +1,159 @@ + + + + + + 100 + Performance + , + + + 100 + Accessibility + , + + + 100 + Best Practices + , + + + 100 + SEO + + + + + + + + + + + + + + 0-49 + 50-89 + 90-100 + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..42e9157 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,417 @@ +# Changelog + +All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. + +## v4.7.0 (2024-10-15) + +### Feat + +- add archives page with configurable menu (#386) + +## v4.6.0 (2024-10-13) + +### Feat + +- add edit post feature in blog posts (#384) + +### Refactor + +- remove duplicate [page].astro (#389) + +## v4.5.1 (2024-10-02) + +### Fix + +- **docs**: update giscus blog post (#392) +- add missing posts sorting (#383) + +## v4.5.0 (2024-09-16) + +### Feat + +- add prev/next links at the bottom of blog post (#372) + +### Fix + +- **og**: add the missing SITE.website to loadGoogleFonts (#360) +- **blog**: correct file reference in reading time guide (#359) + +### Refactor + +- replace pagination logic with Astro built-in pagination (#376) + +### Perf + +- preload font and load theme script asynchronously (#380) + +## v4.4.0 (2024-08-19) + +### Content Layer API + +- upgrade Astro and use Content Layer API (#355) + +### Others + +- upgrade ESLint to v9 and update configurations (#356) +- replace github-slugger with lodash.kebabcase (#357) + +## v4.3.2 (2024-08-17) + +### Fix + +- **a11y**: remove aria-labels from non-interactive elements (#346) + +### Refactor + +- update tailwind classes to v3 syntax (#345) +- remove commented codes + +### Others + +- docs: update estimated reading time blog post (#354) +- docs: add instructions for Google Site Verification in AstroPaper (#353) +- docs: update pre-commit hook blog post (#344) +- ci: add CI workflow (#340) + +## v4.3.1 (2024-07-27) + +### Fix + +- resolve non-latin char issue in generated OG images (#318) + +## v4.3.0 (2024-07-27) + +### Feat + +- support light/dark theme in code blocks (#327) +- add number of posts config for home page (#281) +- make heading links keyboard focusable (#275) +- add JSON-LD structured data (#260) +- add scroll indicator in blog posts (#249) + +### Fix + +- adding data-theme to tailwind config (#319) +- avoid `undefined` when passing class-name as prop (#270) +- add $CURRENT_TIMEZONE_OFFSET in custom code snippets (#264) +- display `Updated` in posts only when modDatetime > pubDatetime (#258) +- add SITE.title in PostDetails title tag for consistent look (#247) +- add trailing slash to links to avoid extra redirects (#246) +- update incorrect typo in predefined-color-schemes.md (#245) + +### Refactor + +- remove trailing commas in tsconfig.json (#325) +- remove redundant role in article element (#323) +- avoid using unnecessary class-name in the pagination component (#274) +- update post detail script codes +- update code formatting with prettier + +## [4.2.0](https://github.com/satnaing/astro-paper/compare/v4.1.0...v4.2.0) (2024-01-22) + +### Features + +* add heading links to PostDetails page ([#232](https://github.com/satnaing/astro-paper/issues/232)) ([742baff](https://github.com/satnaing/astro-paper/commit/742baff2c9bd47e0762f5d65f5b47a4d28014175)) +* hide posts in Prod with future pubDatetime ([#234](https://github.com/satnaing/astro-paper/issues/234)) ([3efa05c](https://github.com/satnaing/astro-paper/commit/3efa05cc101688c32fc531af0122023d3ce82f08)) + +### Bug Fixes + +* remove extra padding if lightAndDarkMode is false ([#230](https://github.com/satnaing/astro-paper/issues/230)) ([742314e](https://github.com/satnaing/astro-paper/commit/742314e0ac350a70ce1cc256e858c8de9c9153f6)) +* reduce margin-bottom on markdown images ([#235](https://github.com/satnaing/astro-paper/issues/235)) ([1331795](https://github.com/satnaing/astro-paper/commit/1331795a4965aab5c47581c223f32f3ea2cd71ab)) +* resolve broken line break in inline code ([#237](https://github.com/satnaing/astro-paper/issues/237)) ([ece0682](https://github.com/satnaing/astro-paper/commit/ece0682adce387f2a169185680cdf372a457e938)) +* remove recent posts section if there's no post ([#238](https://github.com/satnaing/astro-paper/issues/238)) ([629dbfd](https://github.com/satnaing/astro-paper/commit/629dbfda5b99a71e629dbbf1845c3ceba5ac97e0)), closes [#204](https://github.com/satnaing/astro-paper/issues/204) +* update back button to redirect to home when no route history ([#241](https://github.com/satnaing/astro-paper/issues/241)) ([8f75f0a](https://github.com/satnaing/astro-paper/commit/8f75f0a5e75778a60e8030bb45b19289c0af502e)) + +### Others + +* upgrade astro and other dependencies ([e903b69](https://github.com/satnaing/astro-paper/commit/e903b699cd947301256de1e62ae0ad2d1dcd3c2b)) +* update code formatting with prettier ([424c422](https://github.com/satnaing/astro-paper/commit/424c422392d836516bfbb6004a234a1a57930be1)) +* add astro extension in lint-staged code formatting ([d41bb69](https://github.com/satnaing/astro-paper/commit/d41bb69cd8f441caa773a07d911adb3ade54b493)) +* update outdated prettier script ([1281b93](https://github.com/satnaing/astro-paper/commit/1281b9340a6bebd67628a8d4c56f318701ffde47)) + +## [4.1.0](https://github.com/satnaing/astro-paper/compare/v4.0.0...v4.1.0) (2024-01-10) + +### Features + +* update Astro and other dependencies ([f70a0b7](https://github.com/satnaing/astro-paper/commit/f70a0b78ed44350f6d1b00153ea0cc5b7d285043)) ([034dd39](https://github.com/satnaing/astro-paper/commit/034dd394abd4df5cb95fcfe975749cc535a6c05c)) +* add share links in blog post ([#215](https://github.com/satnaing/astro-paper/issues/215)) +* add copy buttons for code blocks ([#217](https://github.com/satnaing/astro-paper/issues/217)) + +### Bug Fixes + +* resolve accessibility issues ([#226](https://github.com/satnaing/astro-paper/issues/226)) +* solve modDatetime type errors ([#214](https://github.com/satnaing/astro-paper/issues/214)) +* remove SocialObjects type and update SocialObjects type ([#225](https://github.com/satnaing/astro-paper/issues/225)) + +### Others + +* adds blog post for how to add a social icon ([#221](https://github.com/satnaing/astro-paper/issues/221)) +* updates the hook post with a smarter updateHook ([#222](https://github.com/satnaing/astro-paper/issues/222)) +* update breadcrumbs delimiter to "»" ([#213](https://github.com/satnaing/astro-paper/issues/213)) + +## [4.0.0](https://github.com/satnaing/astro-paper/compare/v3.0.0...v4.0.0) (2024-01-04) + + +### ⚠ BREAKING CHANGES + +* Astro v4 upgrade + +### Features + +* add code-snippets for content creation ([#206](https://github.com/satnaing/astro-paper/issues/206)) ([bb2f290](https://github.com/satnaing/astro-paper/commit/bb2f29008a96a0333e4c3adda202d20909728dfe)) +* add docker-compose file ([#174](https://github.com/satnaing/astro-paper/issues/174)) ([fb3fa98](https://github.com/satnaing/astro-paper/commit/fb3fa98936d76331869641014d5b4568a84d8d42)), closes [#172](https://github.com/satnaing/astro-paper/issues/172) +* add image validation to schema ([e9d4303](https://github.com/satnaing/astro-paper/commit/e9d4303219bf312bc3955bb8af9aedb0eadb17cc)) +* add modified datetime in blog posts ([80e67a1](https://github.com/satnaing/astro-paper/commit/80e67a1dcad19394d7b466472f3c674470db8e0c)), closes [#134](https://github.com/satnaing/astro-paper/issues/134) +* add pagination in tag posts ([#201](https://github.com/satnaing/astro-paper/issues/201)) ([581826a](https://github.com/satnaing/astro-paper/commit/581826a5affd03d12416a5ac7d28ed17d53eac8d)), closes [#152](https://github.com/satnaing/astro-paper/issues/152) +* add transition effect if light/dark changes ([a060cb5](https://github.com/satnaing/astro-paper/commit/a060cb5c87f733c455ea247d72f88095f1ca769c)) +* add view transitions for card on search page ([#118](https://github.com/satnaing/astro-paper/issues/118)) ([6c7d04f](https://github.com/satnaing/astro-paper/commit/6c7d04fa12d006379157cf876c2826f606f124e9)) +* add ViewTransitions from Astro ([cbdaa59](https://github.com/satnaing/astro-paper/commit/cbdaa59baea1c5c5497227dd2fb276e8cf88b936)), closes [#96](https://github.com/satnaing/astro-paper/issues/96) +* default post author to site author ([20c8970](https://github.com/satnaing/astro-paper/commit/20c89709ada7e7c3f49460d6690d02999ba86d17)) +* dynamically generate robots.txt ([6352353](https://github.com/satnaing/astro-paper/commit/63523534703c1f95ac070452001070e2c3f74d5d)) +* generate og image using templates ([3032c18](https://github.com/satnaing/astro-paper/commit/3032c18321dfd4f001bc86c094881219bd2e22b7)) +* implement back-to-top button in blog post page ([c526157](https://github.com/satnaing/astro-paper/commit/c526157118b69ff68e3a653eee68428a791a7d9f)), closes [#156](https://github.com/satnaing/astro-paper/issues/156) +* og image routes ([300d014](https://github.com/satnaing/astro-paper/commit/300d014fd7a83f52020bdc21976de8487eb41f63)) +* replace slugified title with unslugified tag name ([#198](https://github.com/satnaing/astro-paper/issues/198)) ([b05b8fb](https://github.com/satnaing/astro-paper/commit/b05b8fb842b43f4f6462b425cb46d835579cbcfb)), closes [#179](https://github.com/satnaing/astro-paper/issues/179) +* support custom canonical URLs ([#83](https://github.com/satnaing/astro-paper/issues/83)) ([4687bd5](https://github.com/satnaing/astro-paper/commit/4687bd516b16970fc4d163c1202b28f29818a582)) +* update theme-color tag on theme switch ([f253776](https://github.com/satnaing/astro-paper/commit/f25377674ebc10f496ef6e5729b931d61ec67832)) + + +### Bug Fixes + +* [#133](https://github.com/satnaing/astro-paper/issues/133) update LOCALE config to cover overall locales ([cd02b04](https://github.com/satnaing/astro-paper/commit/cd02b047d2b5e3b4a2940c0ff30568cdebcec0b8)) +* [#72](https://github.com/satnaing/astro-paper/issues/72) replace SITE.website with a URL in astro.config site value ([26ecd17](https://github.com/satnaing/astro-paper/commit/26ecd173ddec1075abb6ede9bbb62572b9f74b33)) +* anchor oveflow on small screen size ([d025c91](https://github.com/satnaing/astro-paper/commit/d025c914d91a9b7969c8db4bd6a700723ef86a39)) +* **css:** text wrap in code blocks ([0c92492](https://github.com/satnaing/astro-paper/commit/0c92492959bed20f144d5d949116891d61c8e098)) +* decode unicode tag chars in breadcrumb ([#175](https://github.com/satnaing/astro-paper/issues/175)) ([058c790](https://github.com/satnaing/astro-paper/commit/058c790d26cbeab286679a8a8e3bad6c14042d6d)) +* get og image url correctly ([7f3edbd](https://github.com/satnaing/astro-paper/commit/7f3edbdecdce597d15e562e7d497d69af505d550)) +* **layout:** use 100svh for min-height on body instead of 100vh ([79d569d](https://github.com/satnaing/astro-paper/commit/79d569d053036f2113519f41b0d257523d035b76)), closes [#127](https://github.com/satnaing/astro-paper/issues/127) +* og image src ([6dffcf3](https://github.com/satnaing/astro-paper/commit/6dffcf3cb36a0dab6549ee249fe426b4ee931b06)) +* prevent white flash in dark mode when navigate ([9eeb8fc](https://github.com/satnaing/astro-paper/commit/9eeb8fc76ecfd45b79ab716305f1916491649c95)) +* remove empty string as ogImage ([b03b722](https://github.com/satnaing/astro-paper/commit/b03b7223694b4c215c6fce0a45ed4f03178081f4)) +* resolve single-line code block wrapping issue ([#121](https://github.com/satnaing/astro-paper/issues/121)) ([0af3251](https://github.com/satnaing/astro-paper/commit/0af32518b343430dd8510470efd3806509337de7)) +* solve invisible text code block issue in light-mode ([#163](https://github.com/satnaing/astro-paper/issues/163)) ([64b3a28](https://github.com/satnaing/astro-paper/commit/64b3a286e6e3ff1dff7cf4ca0fc8fafc222cabcd)) +* sort posts in [tag] page ([#101](https://github.com/satnaing/astro-paper/issues/101)) ([b571816](https://github.com/satnaing/astro-paper/commit/b571816dcddc72a07147389090502c09025b28a6)) +* update auto-gen OG images to allow special char usage in title ([1933a6b](https://github.com/satnaing/astro-paper/commit/1933a6beae7b4e2558b808d1f8a5c124f1244138)), closes [#103](https://github.com/satnaing/astro-paper/issues/103) [#88](https://github.com/satnaing/astro-paper/issues/88) +* update rss pubDate to prioritize modDatetime if exists ([e1514b4](https://github.com/satnaing/astro-paper/commit/e1514b41024bc10bcafcc4af548a6ebe0e093468)) +* update tailwind base styles config ([#116](https://github.com/satnaing/astro-paper/issues/116)) ([4a03558](https://github.com/satnaing/astro-paper/commit/4a0355865081d07d05d9d758f520e411952a1063)) +* update title of the blog nowrap ([87b3e5b](https://github.com/satnaing/astro-paper/commit/87b3e5b8cd7d424b3e43e6d5abed6d21195aa759)) + + +* build!(deps): upgrade Astro and related packages to v4 ([a1d3ddd](https://github.com/satnaing/astro-paper/commit/a1d3ddd18591843a35b3c05be762e1f8af1b8fb0)), closes [#187](https://github.com/satnaing/astro-paper/issues/187) + +## [3.0.0](https://github.com/satnaing/astro-paper/compare/v2.3.0...v3.0.0) (2023-09-25) + +### ⚠ BREAKING CHANGES + +* Astro v3 + +> Check the AstroPaper v3 in [this blog post](https://astro-paper.pages.dev/posts/astro-paper-v3/) + +### Features + +* upgrade to astro v3 ([8fda50f](https://github.com/satnaing/astro-paper/commit/8fda50f5ddb7130b7954ad217eed1848094ee33c)), closes [#111](https://github.com/satnaing/astro-paper/issues/111) +* add view transitions for card on search page ([#118](https://github.com/satnaing/astro-paper/issues/118)) ([b873ed5](https://github.com/satnaing/astro-paper/commit/b873ed5a07e746404960690669e8960c2a4c628d)) +* add ViewTransitions from Astro ([9703e54](https://github.com/satnaing/astro-paper/commit/9703e54ca4264b0437e06c45bbcc53a7a7d1e106)), closes [#96](https://github.com/satnaing/astro-paper/issues/96) +([b873ed5](https://github.com/satnaing/astro-paper/commit/b873ed5a07e746404960690669e8960c2a4c628d)), closes [#96](https://github.com/satnaing/astro-paper/issues/96) +* generate OG image using templates ([0f82206](https://github.com/satnaing/astro-paper/commit/0f822060cec82b218b568e9ef311fe6adc8b7a1e)) +* support custom canonical URLs ([#83](https://github.com/satnaing/astro-paper/issues/83)) ([4687bd5](https://github.com/satnaing/astro-paper/commit/4687bd516b16970fc4d163c1202b28f29818a582)) +* update theme-color tag on theme switch ([b5f5418](https://github.com/satnaing/astro-paper/commit/b5f54180c8645113ae4e177f3ebb97e1947dc9e2)) +* use new og images in layout ([ec3c691](https://github.com/satnaing/astro-paper/commit/ec3c69114f7344b27797853e2e5a573feb5c63fc)) + + +### Bug Fixes + +* replace SITE.website with a URL in astro.config site value ([26ecd17](https://github.com/satnaing/astro-paper/commit/26ecd173ddec1075abb6ede9bbb62572b9f74b33)), fixes [#72](https://github.com/satnaing/astro-paper/issues/72) +* **css:** make code scrollable in code blocks ([0c92492](https://github.com/satnaing/astro-paper/commit/0c92492959bed20f144d5d949116891d61c8e098)) +* remove empty string as ogImage ([5259994](https://github.com/satnaing/astro-paper/commit/5259994525b0b67a584b4268a3fbb74258871a3a)) +* resolve single-line code block wrapping issue ([#121](https://github.com/satnaing/astro-paper/issues/121)) ([8f08018](https://github.com/satnaing/astro-paper/commit/8f0801836a589133932dc5a450060fd2f16daf74)) +* sort posts in [tag] page ([#101](https://github.com/satnaing/astro-paper/issues/101)) ([b571816](https://github.com/satnaing/astro-paper/commit/b571816dcddc72a07147389090502c09025b28a6)) +* update auto-gen OG images to allow special char usage in title ([f26bf85](https://github.com/satnaing/astro-paper/commit/f26bf8581288523a0d6021a141cdada685fbce46)), closes [#103](https://github.com/satnaing/astro-paper/issues/103) [#88](https://github.com/satnaing/astro-paper/issues/88) +* update tailwind base styles config ([#116](https://github.com/satnaing/astro-paper/issues/116)) ([98a2bb6](https://github.com/satnaing/astro-paper/commit/98a2bb682af2773d6af7782a6592e9b9fab79b3b)) +* update title of the blog nowrap ([2df71b9](https://github.com/satnaing/astro-paper/commit/2df71b9b4587c7a2438f483e8365ef5b8a502ce7)) + +## [2.3.0](https://github.com/satnaing/astro-paper/compare/v2.2.0...v2.3.0) (2023-05-15) + + +### Features + +* add locale configuration for Datetime component ([#59](https://github.com/satnaing/astro-paper/issues/59)) ([0e9f709](https://github.com/satnaing/astro-paper/commit/0e9f709c5dbd9a75aaf33e7994e88216fd56d8be)) + + +### Bug Fixes + +* add missing sitemap in head ([#69](https://github.com/satnaing/astro-paper/issues/69)) ([f6ac810](https://github.com/satnaing/astro-paper/commit/f6ac8104b2ba20de3b71eb5dde395e5adce9dfe7)) +* build error astro@2.1.4 && update astro@2.1.5 ([#49](https://github.com/satnaing/astro-paper/issues/49)) ([dd4fd98](https://github.com/satnaing/astro-paper/commit/dd4fd989722cbcb3e98045e808a32292cf555900)) +* **ignore:** added yarn directories to ignorefiles ([f3e9cd5](https://github.com/satnaing/astro-paper/commit/f3e9cd51479fd41f3c0e8863ac13c77d6daa2605)) +* replace history entries when searching ([#62](https://github.com/satnaing/astro-paper/issues/62)) ([a57f343](https://github.com/satnaing/astro-paper/commit/a57f3439f801c1d41256a8a46bd319c17dff86f1)) +* slugify tags in post detail page ([49d7f77](https://github.com/satnaing/astro-paper/commit/49d7f77a86987c00d211090301b662e21a27ce17)) +* sort rss feed from latest to oldest ([#38](https://github.com/satnaing/astro-paper/issues/38)) ([9e62b63](https://github.com/satnaing/astro-paper/commit/9e62b637e8ddb65f5f274fd0154191212dda0590)) +* tailwind jsdoc for intellisense ([99709dd](https://github.com/satnaing/astro-paper/commit/99709dd3aa2329220a497f7038b7ab069d389847)) +* update lint-staged configuration ([e654c03](https://github.com/satnaing/astro-paper/commit/e654c0308c26ccffdd0a4abc50f0adb99c76d9ca)), closes [#52](https://github.com/satnaing/astro-paper/issues/52) +* update menu element with svg and refactor toggle logic ([0f76424](https://github.com/satnaing/astro-paper/commit/0f764242fea14565798085447d8524b4bf05f76a)) + +## [2.2.0](https://github.com/satnaing/astro-paper/compare/v2.1.0...v2.2.0) (2023-03-16) + + +### Features + +* generate og images in png format ([#43](https://github.com/satnaing/astro-paper/issues/43)) ([27507d1](https://github.com/satnaing/astro-paper/commit/27507d1d78531901c20a17d9ce72728c6cbb521e)), closes [#40](https://github.com/satnaing/astro-paper/issues/40) + + +### Bug Fixes + +* add plugin-search-dir in prettier write for pnpm ([e49ca61](https://github.com/satnaing/astro-paper/commit/e49ca61d6b7048a8e8b2f50b1d947fd91eaca3eb)), ([37b54af](https://github.com/satnaing/astro-paper/commit/37b54afd9471eb35588e09f1f33ae1634732b02c)), closes [#34](https://github.com/satnaing/astro-paper/issues/34) +* correct typo in blog posts ([cbce54b](https://github.com/satnaing/astro-paper/commit/cbce54bd1cf951c36a8603db8f7a8487481fc7f1)), closes [#35](https://github.com/satnaing/astro-paper/issues/35) +* slugifyAll typo ([bcae985](https://github.com/satnaing/astro-paper/commit/bcae9856712773887664bb3a3392e1ebfd78607b)) + +### Others + +* update Astro to v2.1.3 and enable type checking in dev ([329bc22](https://github.com/satnaing/astro-paper/commit/329bc22e97892e5687a841d580215c8fb2d44aa1)) +* add jampack for performance optimization ([#46](https://github.com/satnaing/astro-paper/pull/46)) ([b9254c1](https://github.com/satnaing/astro-paper/commit/b9254c15f1b382c2f3900b3371abce8975768dd9)) + +## [2.1.0](https://github.com/satnaing/astro-paper/compare/v2.0.0...v2.1.0) (2023-02-08) + + +### Features + +* add ESLint and update linting errors ([#26](https://github.com/satnaing/astro-paper/issues/26)) ([a9631d0](https://github.com/satnaing/astro-paper/commit/a9631d0e1e65ac4339c6b4d806b3a17928fa2b62)) + + +### Bug Fixes + +* make schema(s) strict ([#23](https://github.com/satnaing/astro-paper/issues/23)) ([dc026b3](https://github.com/satnaing/astro-paper/commit/dc026b38defa760d77eddcddb1d4f12fdf8fff99)) +* fix typo and remove unnecessary comments ([#24](https://github.com/satnaing/astro-paper/pull/24)) ([d9a2ffe](https://github.com/satnaing/astro-paper/commit/d9a2ffe9096e2419a740c5b98b57323fbf2f2cb0)) ([#25](https://github.com/satnaing/astro-paper/pull/25)) ([29e0776](https://github.com/satnaing/astro-paper/commit/29e07761f78fa24b307601bf2272a61e084a468b)) +* update dependencies + +## [2.0.0](https://github.com/satnaing/astro-paper/compare/v1.4.0...v2.0.0) (2023-01-31) + + +### ⚠ BREAKING CHANGES + +Check the AstroPaper v2 in [this blog post](https://astro-paper.pages.dev/posts/astro-paper-2/) + +* **deps:** Migration of Astro to version 2 + +### Features + +* add Mastodon social link ([2ec3912](https://github.com/satnaing/astro-paper/commit/2ec39128c65fd0b1dafd6aebd48ac3068f40f9c5)) +* add new predefined color scheme 'astro dark' ([bc263b6](https://github.com/satnaing/astro-paper/commit/bc263b6eac00fbc8ec62481f2ec0317ee11bc83a)) +* define blog schema and add blog collection ([b420e68](https://github.com/satnaing/astro-paper/commit/b420e688ca3a197a7e4ea2591193fd09da817ec7)) + + +### Bug Fixes + +* add embedFont option for Satori ([9322123](https://github.com/satnaing/astro-paper/commit/93221239ddaebaa9ab183871cf978548ea8d0ea5)) +* exclude draft posts in specific tag page ([c192cd8](https://github.com/satnaing/astro-paper/commit/c192cd8e5042d4481bcb0d0389866cf4a969aa8d)) +* fix broken tags in PostDetails page ([a61fd45](https://github.com/satnaing/astro-paper/commit/a61fd455594932c66380a358b81b8bebb9d604cc)) +* fix typo in title and slug ([945acf4](https://github.com/satnaing/astro-paper/commit/945acf4260e0ea79bde8b180835049eda07d3e6a)) +* hide social links section if no link is active ([42eb018](https://github.com/satnaing/astro-paper/commit/42eb0188896a8475a7fbb894775e5500ca8b7d35)), closes [#16](https://github.com/satnaing/astro-paper/issues/16) +* make the last part of breadcrumb lowercase in specific tag page ([c556202](https://github.com/satnaing/astro-paper/commit/c556202c972f1f9fed9af0ba6abf199e7deccc5f)) +* resolve initial onChange input value bug ([bf4f687](https://github.com/satnaing/astro-paper/commit/bf4f687d2d87cfeef96141c5324d02c37766845b)) +* update card bg color ([8a99601](https://github.com/satnaing/astro-paper/commit/8a99601e93f90c0870a22aa4a8ea8b7ff1b76a98)) +* use default-og for twitter card ([9434d85](https://github.com/satnaing/astro-paper/commit/9434d850e1f41f0802de5706c4c5712e5b5def9d)) + + +### build + +* **deps:** bump astro and its packages to v2 ([5f279b3](https://github.com/satnaing/astro-paper/commit/5f279b34f88bd94bed820d16c1e1d5e95859045f)) + +## [1.4.0](https://github.com/satnaing/astro-paper/compare/v1.3.0...v1.4.0) (2022-12-28) + + +### Features + +* generate dynamic og image for blog posts ([#15](https://github.com/satnaing/astro-paper/issues/15)) ([ce3f1dc](https://github.com/satnaing/astro-paper/commit/ce3f1dc4a0df8f196dce37de1c976870e9c97279)) + + +### Bug Fixes + +* fix grammar mistake ([02faff9](https://github.com/satnaing/astro-paper/commit/02faff9fbd4444144eeb139ae62850ec5a980dd3)) + +## [1.3.0](https://github.com/satnaing/astro-paper/compare/v1.2.1...v1.3.0) (2022-12-07) + + +### Features + +* update mobile nav to be accessible ([46ea4aa](https://github.com/satnaing/astro-paper/commit/46ea4aa49a49a3d21ca5ce1cee1b51f0108c13f0)) + +### [1.2.1](https://github.com/satnaing/astro-paper/compare/v1.2.0...v1.2.1) (2022-12-02) + + +### Bug Fixes + +* disable access to draft posts via url ([1c2821e](https://github.com/satnaing/astro-paper/commit/1c2821e4df65bee7126aed17244bb6590b1163d8)) +* display '0 results' instead of '0 result' in Search ([eceb289](https://github.com/satnaing/astro-paper/commit/eceb2895623cffefc65671fdfc343fa5e4c01cdb)) +* displays featured section only if featured posts exist ([e0f93da](https://github.com/satnaing/astro-paper/commit/e0f93dab02024d65ddb69925a21e8d8598a036e9)) +* fix calculating draft posts in totalPages ([19e34a0](https://github.com/satnaing/astro-paper/commit/19e34a0801019df8681d1d4e80f678989cf2457c)) +* hide pagination when there's only 1 page ([6b35c7f](https://github.com/satnaing/astro-paper/commit/6b35c7fc2f63bb16aaefc140029b1eae1235cc44)) + +## [1.2.0](https://github.com/satnaing/astro-paper/compare/v1.1.3...v1.2.0) (2022-11-28) + + +### Features + +* improve accessibility including voiceover ([5860254](https://github.com/satnaing/astro-paper/commit/5860254ea99996e466f2e521f033763961b6faa6)) +* add linkTitle in social links ([c9f796f](https://github.com/satnaing/astro-paper/commit/c9f796f4e63f1cf6b32b7874ae5e3810598a230c)) + + +### Updates + +* move toggle theme codes from `layouts/Layout.astro` to `toggle-theme.js` ([5860254](https://github.com/satnaing/astro-paper/commit/5860254ea99996e466f2e521f033763961b6faa6)) +* delete `utils/formatDatetime.ts` and replaced with `FormattedDatetime` inside `components/Datetime.tsx` ([0eeed8e](https://github.com/satnaing/astro-paper/commit/0eeed8e870781d9b4a447c51e3055ccb2f359d8a)) +* 'toggling light and dark mode' code is remove from `src/components/Header.astro` and is rewritten in `public/toggle-theme.js` file. ([2ba459b](https://github.com/satnaing/astro-paper/commit/2ba459b4131a11a68a5fd818a278c474c1888cde)) ([0eeed8e](https://github.com/satnaing/astro-paper/commit/0eeed8e870781d9b4a447c51e3055ccb2f359d8a)) +* update previous and next button disabled state ([408fc4c](https://github.com/satnaing/astro-paper/commit/408fc4c7aa5a246fe82a6e85d119b36ee1f1ffc3)) +* **typo:** rename Linkedin to LinkedIn ([307b55f](https://github.com/satnaing/astro-paper/commit/307b55ff0f6cb86a4fa4152c635d6acb39d1512f)) +* update patch and minor dependencies ([3b0ab75](https://github.com/satnaing/astro-paper/commit/3b0ab7555f506a8a0b825ca9691fdb221e481adb)) ([c3a6e4e](https://github.com/satnaing/astro-paper/commit/c3a6e4e81d1f79efc17d451486ff560dccb8ddf0)) + +### [1.1.3](https://github.com/satnaing/astro-paper/compare/v1.1.2...v1.1.3) (2022-11-11) + + +### Bug Fixes + +* fix broken post links and hide draft posts in rss feed ([b83c906](https://github.com/satnaing/astro-paper/commit/b83c906262cb5e1f045ac50f2401527c0b64074c)) + +### [1.1.2](https://github.com/satnaing/astro-paper/compare/v1.1.1...v1.1.2) (2022-11-04) + + +### Bug Fixes + +* fix heading style in posts/ layouts ([5eeea66](https://github.com/satnaing/astro-paper/commit/5eeea6639e79f93c3d0917bc827dfd37a23d041c)) +* fix missing TailwindCSS dependency ([e7807ab](https://github.com/satnaing/astro-paper/commit/e7807ab94e12898ab85b955132c5d908956c8945)), closes [#6](https://github.com/satnaing/astro-paper/issues/6) +* show search result only if input is more than one char ([f7fb032](https://github.com/satnaing/astro-paper/commit/f7fb032e604bd704adc19400e000c9584a6fdb43)) + +### [1.1.1](https://github.com/satnaing/astro-paper/compare/v1.1.0...v1.1.1) (2022-10-30) + + +### Updates + +* update github-slugger by @AkaraChen in https://github.com/satnaing/astro-paper/pull/5 +* move '@types/react' to dev dependencies ([3697a59](https://github.com/satnaing/astro-paper/commit/3697a59f1ab8b58af7d41c2ef4aa8ba97b9ad1e2)) +* update dependencies + +## [1.1.0](https://github.com/satnaing/astro-paper/compare/v1.0.1...v1.1.0) (2022-10-18) + +### Features + +* improve search functionality ([33bab9c](https://github.com/satnaing/astro-paper/commit/33bab9c489d74e1b53109d5f1e8f3586cfcb9433)) +* add CHANGELOG ([adb331e](https://github.com/satnaing/astro-paper/commit/adb331e219d122be696fb390ae41f0afaa5a76b9)) +* add prettier and husky ([d6dd818](https://github.com/satnaing/astro-paper/commit/d6dd8185f28cfae967cf90c9020580ebce5c36fd) | [80aee6b](https://github.com/satnaing/astro-paper/commit/80aee6bedbc1e40650411b0695f5365902d3b9e2)) + +### Bug Fixes + +* fix markdown lint warnings by updating headers ([ad14dc5](https://github.com/satnaing/astro-paper/commit/ad14dc580fbf886f5de95705ec7910c7c3b46bf0)) +* fix markdown warnings by adding alt texts ([3260641](https://github.com/satnaing/astro-paper/commit/326064111cbb7d356659252dd7ddd42dbd2d7e56)) +* extract Social component to avoid duplication ([7ef631f](https://github.com/satnaing/astro-paper/commit/7ef631fe35dc57db1c84e7c3c92969fa23ccd42b)) +* update glob to have access to sub directories under content/ ([a256ded](https://github.com/satnaing/astro-paper/commit/a256dedb73aaf018cedf764f38843ad176b27058)) + +## [1.0.1](https://github.com/satnaing/astro-paper/compare/v1.0.0...v1.0.1) (2022-09-27) Initial Release + +### Features + +- Fully responsive & accessible +- Pagination & draft post +- Light & dark color schemes +- 19 social link icons +- Fuzzy search +- Sitemap & RSS feed +- 5 predefined themes diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..754c962 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# Base stage for building the static files +FROM node:lts AS base +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +# Runtime stage for serving the application +FROM nginx:mainline-alpine-slim AS runtime +COPY --from=base ./app/dist /usr/share/nginx/html +EXPOSE 80 \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fa7c791 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Sat Naing + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..46a3d59 --- /dev/null +++ b/README.md @@ -0,0 +1,187 @@ +# AstroPaper 📄 + +![AstroPaper](public/astropaper-og.jpg) +[![Figma](https://img.shields.io/badge/Figma-F24E1E?style=for-the-badge&logo=figma&logoColor=white)](https://www.figma.com/community/file/1356898632249991861) +![Typescript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white) +![GitHub](https://img.shields.io/github/license/satnaing/astro-paper?color=%232F3741&style=for-the-badge) +[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits&logoColor=white&style=for-the-badge)](https://conventionalcommits.org) +[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge)](http://commitizen.github.io/cz-cli/) + +AstroPaper is a minimal, responsive, accessible and SEO-friendly Astro blog theme. This theme is designed and crafted based on [my personal blog](https://satnaing.dev/blog). + +This theme follows best practices and provides accessibility out of the box. Light and dark mode are supported by default. Moreover, additional color schemes can also be configured. + +This theme is self-documented \_ which means articles/posts in this theme can also be considered as documentations. Read [the blog posts](https://astro-paper.pages.dev/posts/) or check [the README Documentation Section](#-documentation) for more info. + +## 🔥 Features + +- [x] type-safe markdown +- [x] super fast performance +- [x] accessible (Keyboard/VoiceOver) +- [x] responsive (mobile ~ desktops) +- [x] SEO-friendly +- [x] light & dark mode +- [x] fuzzy search +- [x] draft posts & pagination +- [x] sitemap & rss feed +- [x] followed best practices +- [x] highly customizable +- [x] dynamic OG image generation for blog posts [#15](https://github.com/satnaing/astro-paper/pull/15) ([Blog Post](https://astro-paper.pages.dev/posts/dynamic-og-image-generation-in-astropaper-blog-posts/)) + +_Note: I've tested screen-reader accessibility of AstroPaper using **VoiceOver** on Mac and **TalkBack** on Android. I couldn't test all other screen-readers out there. However, accessibility enhancements in AstroPaper should be working fine on others as well._ + +## ✅ Lighthouse Score + +

+ + AstroPaper Lighthouse Score + +

+ +## 🚀 Project Structure + +Inside of AstroPaper, you'll see the following folders and files: + +```bash +/ +├── public/ +│ ├── assets/ +│ │ └── logo.svg +│ │ └── logo.png +│ └── favicon.svg +│ └── astropaper-og.jpg +│ └── robots.txt +│ └── toggle-theme.js +├── src/ +│ ├── assets/ +│ │ └── socialIcons.ts +│ ├── components/ +│ ├── content/ +│ │ | blog/ +│ │ | └── some-blog-posts.md +│ │ └── config.ts +│ ├── layouts/ +│ └── pages/ +│ └── styles/ +│ └── utils/ +│ └── config.ts +│ └── types.ts +└── package.json +``` + +Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. + +Any static assets, like images, can be placed in the `public/` directory. + +All blog posts are stored in `src/content/blog` directory. + +## 📖 Documentation + +Documentation can be read in two formats\_ _markdown_ & _blog post_. + +- Configuration - [markdown](src/content/blog/how-to-configure-astropaper-theme.md) | [blog post](https://astro-paper.pages.dev/posts/how-to-configure-astropaper-theme/) +- Add Posts - [markdown](src/content/blog/adding-new-post.md) | [blog post](https://astro-paper.pages.dev/posts/adding-new-posts-in-astropaper-theme/) +- Customize Color Schemes - [markdown](src/content/blog/customizing-astropaper-theme-color-schemes.md) | [blog post](https://astro-paper.pages.dev/posts/customizing-astropaper-theme-color-schemes/) +- Predefined Color Schemes - [markdown](src/content/blog/predefined-color-schemes.md) | [blog post](https://astro-paper.pages.dev/posts/predefined-color-schemes/) + +> For AstroPaper v1, check out [this branch](https://github.com/satnaing/astro-paper/tree/astro-paper-v1) and this [live URL](https://astro-paper-v1.astro-paper.pages.dev/) + +## 💻 Tech Stack + +**Main Framework** - [Astro](https://astro.build/) +**Type Checking** - [TypeScript](https://www.typescriptlang.org/) +**Component Framework** - [ReactJS](https://reactjs.org/) +**Styling** - [TailwindCSS](https://tailwindcss.com/) +**UI/UX** - [Figma Design File](https://www.figma.com/community/file/1356898632249991861) +**Fuzzy Search** - [FuseJS](https://fusejs.io/) +**Icons** - [Boxicons](https://boxicons.com/) | [Tablers](https://tabler-icons.io/) +**Code Formatting** - [Prettier](https://prettier.io/) +**Deployment** - [Cloudflare Pages](https://pages.cloudflare.com/) +**Illustration in About Page** - [https://freesvgillustration.com](https://freesvgillustration.com/) +**Linting** - [ESLint](https://eslint.org) + +## 👨🏻‍💻 Running Locally + +You can start using this project locally by running the following command in your desired directory: + +```bash +# npm 6.x +npm create astro@latest --template satnaing/astro-paper + +# npm 7+, extra double-dash is needed: +npm create astro@latest -- --template satnaing/astro-paper + +# yarn +yarn create astro --template satnaing/astro-paper + +# pnpm +pnpm dlx create-astro --template satnaing/astro-paper +``` + +> **_Warning!_** If you're using `yarn 1`, you might need to [install `sharp`](https://sharp.pixelplumbing.com/install) as a dependency. + +Then start the project by running the following commands: + +```bash +# install dependencies +npm run install + +# start running the project +npm run dev +``` + +As an alternative approach, if you have Docker installed, you can use Docker to run this project locally. Here's how: + +```bash +# Build the Docker image +docker build -t astropaper . + +# Run the Docker container +docker run -p 4321:80 astropaper +``` + +## Google Site Verification (optional) + +You can easily add your [Google Site Verification HTML tag](https://support.google.com/webmasters/answer/9008080#meta_tag_verification&zippy=%2Chtml-tag) in AstroPaper using an environment variable. This step is optional. If you don't add the following environment variable, the google-site-verification tag won't appear in the HTML `` section. + +```bash +# in your environment variable file (.env) +PUBLIC_GOOGLE_SITE_VERIFICATION=your-google-site-verification-value +``` + +> See [this discussion](https://github.com/satnaing/astro-paper/discussions/334#discussioncomment-10139247) for adding AstroPaper to the Google Search Console. + +## 🧞 Commands + +All commands are run from the root of the project, from a terminal: + +> **_Note!_** For `Docker` commands we must have it [installed](https://docs.docker.com/engine/install/) in your machine. + +| Command | Action | +| :----------------------------------- | :------------------------------------------------------------------------------------------------------------------------------- | +| `npm install` | Installs dependencies | +| `npm run dev` | Starts local dev server at `localhost:4321` | +| `npm run build` | Build your production site to `./dist/` | +| `npm run preview` | Preview your build locally, before deploying | +| `npm run format:check` | Check code format with Prettier | +| `npm run format` | Format codes with Prettier | +| `npm run sync` | Generates TypeScript types for all Astro modules. [Learn more](https://docs.astro.build/en/reference/cli-reference/#astro-sync). | +| `npm run lint` | Lint with ESLint | +| `docker compose up -d` | Run AstroPaper on docker, You can access with the same hostname and port informed on `dev` command. | +| `docker compose run app npm install` | You can run any command above into the docker container. | +| `docker build -t astropaper .` | Build Docker image for AstroPaper. | +| `docker run -p 4321:80 astropaper` | Run AstroPaper on Docker. The website will be accessible at `http://localhost:4321`. | + +> **_Warning!_** Windows PowerShell users may need to install the [concurrently package](https://www.npmjs.com/package/concurrently) if they want to [run diagnostics](https://docs.astro.build/en/reference/cli-reference/#astro-check) during development (`astro check --watch & astro dev`). For more info, see [this issue](https://github.com/satnaing/astro-paper/issues/113). + +## ✨ Feedback & Suggestions + +If you have any suggestions/feedback, you can contact me via [my email](mailto:contact@satnaing.dev). Alternatively, feel free to open an issue if you find bugs or want to request new features. + +## 📜 License + +Licensed under the MIT License, Copyright © 2023 + +--- + +Made with 🤍 by [Sat Naing](https://satnaing.dev) 👨🏻‍💻 and [contributors](https://github.com/satnaing/astro-paper/graphs/contributors). diff --git a/astro.config.ts b/astro.config.ts new file mode 100644 index 0000000..f88795b --- /dev/null +++ b/astro.config.ts @@ -0,0 +1,44 @@ +import { defineConfig } from "astro/config"; +import tailwind from "@astrojs/tailwind"; +import react from "@astrojs/react"; +import remarkToc from "remark-toc"; +import remarkCollapse from "remark-collapse"; +import sitemap from "@astrojs/sitemap"; +import { SITE } from "./src/config"; + +// https://astro.build/config +export default defineConfig({ + site: SITE.website, + integrations: [ + tailwind({ + applyBaseStyles: false, + }), + react(), + sitemap(), + ], + markdown: { + remarkPlugins: [ + remarkToc, + [ + remarkCollapse, + { + test: "Table of contents", + }, + ], + ], + shikiConfig: { + // For more themes, visit https://shiki.style/themes + themes: { light: "github-light", dark: "material-theme-palenight" }, + wrap: true, + }, + }, + vite: { + optimizeDeps: { + exclude: ["@resvg/resvg-js"], + }, + }, + scopedStyleStrategy: "where", + experimental: { + contentLayer: true, + }, +}); diff --git a/cz.yaml b/cz.yaml new file mode 100644 index 0000000..cc639d6 --- /dev/null +++ b/cz.yaml @@ -0,0 +1,7 @@ +--- +commitizen: + name: cz_conventional_commits + tag_format: v$version + update_changelog_on_bump: true + version_provider: npm + version_scheme: semver diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..285e320 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +version: '3' + +services: + app: + image: node:20 + ports: + - 4321:4321 + working_dir: /app + command: npm run dev -- --host 0.0.0.0 + volumes: + - ./:/app diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..2e95428 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,44 @@ +import js from "@eslint/js"; +import globals from "globals"; +import tseslint from "typescript-eslint"; +import astroParser from "astro-eslint-parser"; +import eslintPluginAstro from "eslint-plugin-astro"; + +export default [ + js.configs.recommended, + ...tseslint.configs.recommended, + ...eslintPluginAstro.configs.recommended, + { + languageOptions: { + globals: { + ...globals.browser, + ...globals.node, + }, + }, + }, + { + files: ["*.astro"], + languageOptions: { + parser: astroParser, + parserOptions: { + parser: "@typescript-eslint/parser", + extraFileExtensions: [".astro"], + }, + }, + }, + { + files: ["tailwind.config.cjs", "**/*.d.ts"], + rules: { + "@typescript-eslint/no-require-imports": "off", + "@typescript-eslint/triple-slash-reference": "off", + }, + }, + { + rules: { + "@typescript-eslint/no-unused-expressions": "off", + }, + }, + { + ignores: ["dist/**", ".astro"], + }, +]; diff --git a/package.json b/package.json new file mode 100644 index 0000000..4748052 --- /dev/null +++ b/package.json @@ -0,0 +1,49 @@ +{ + "name": "astro-paper", + "version": "4.7.0", + "private": false, + "scripts": { + "dev": "astro dev", + "start": "astro dev", + "build": "astro build", + "preview": "astro preview", + "sync": "astro sync", + "astro": "astro", + "format:check": "prettier --check . --plugin=prettier-plugin-astro", + "format": "prettier --write . --plugin=prettier-plugin-astro", + "lint": "eslint ." + }, + "dependencies": { + "@astrojs/check": "^0.9.3", + "@astrojs/rss": "^4.0.7", + "@resvg/resvg-js": "^2.6.2", + "astro": "^4.16.3", + "fuse.js": "^7.0.0", + "lodash.kebabcase": "^4.1.1", + "remark-collapse": "^0.1.2", + "remark-toc": "^9.0.0", + "satori": "^0.11.0", + "tailwindcss": "^3.4.11", + "typescript": "^5.5.3" + }, + "devDependencies": { + "@astrojs/react": "^3.6.2", + "@astrojs/sitemap": "^3.1.6", + "@astrojs/tailwind": "^5.1.0", + "@tailwindcss/typography": "^0.5.15", + "@types/github-slugger": "^1.3.0", + "@types/lodash.kebabcase": "^4.1.9", + "@types/react": "^18.3.6", + "@typescript-eslint/parser": "^8.5.0", + "astro-eslint-parser": "^1.0.3", + "eslint": "^9.10.0", + "eslint-plugin-astro": "^1.2.4", + "globals": "^15.9.0", + "prettier": "^3.3.3", + "prettier-plugin-astro": "^0.14.1", + "prettier-plugin-tailwindcss": "^0.6.6", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "typescript-eslint": "^8.5.0" + } +} diff --git a/public/assets/dev.svg b/public/assets/dev.svg new file mode 100644 index 0000000..60e4f51 --- /dev/null +++ b/public/assets/dev.svg @@ -0,0 +1,361 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/forrest-gump-quote.webp b/public/assets/forrest-gump-quote.webp new file mode 100644 index 0000000..7223f43 Binary files /dev/null and b/public/assets/forrest-gump-quote.webp differ diff --git a/public/assets/logo.png b/public/assets/logo.png new file mode 100644 index 0000000..53d6ba8 Binary files /dev/null and b/public/assets/logo.png differ diff --git a/public/assets/logo.svg b/public/assets/logo.svg new file mode 100644 index 0000000..6999eab --- /dev/null +++ b/public/assets/logo.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/public/astropaper-og.jpg b/public/astropaper-og.jpg new file mode 100644 index 0000000..3b351f9 Binary files /dev/null and b/public/astropaper-og.jpg differ diff --git a/public/favicon.svg b/public/favicon.svg new file mode 100644 index 0000000..0f39062 --- /dev/null +++ b/public/favicon.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + diff --git a/public/toggle-theme.js b/public/toggle-theme.js new file mode 100644 index 0000000..146af33 --- /dev/null +++ b/public/toggle-theme.js @@ -0,0 +1,76 @@ +const primaryColorScheme = ""; // "light" | "dark" + +// Get theme data from local storage +const currentTheme = localStorage.getItem("theme"); + +function getPreferTheme() { + // return theme value in local storage if it is set + if (currentTheme) return currentTheme; + + // return primary color scheme if it is set + if (primaryColorScheme) return primaryColorScheme; + + // return user device's prefer color scheme + return window.matchMedia("(prefers-color-scheme: dark)").matches + ? "dark" + : "light"; +} + +let themeValue = getPreferTheme(); + +function setPreference() { + localStorage.setItem("theme", themeValue); + reflectPreference(); +} + +function reflectPreference() { + document.firstElementChild.setAttribute("data-theme", themeValue); + + document.querySelector("#theme-btn")?.setAttribute("aria-label", themeValue); + + // Get a reference to the body element + const body = document.body; + + // Check if the body element exists before using getComputedStyle + if (body) { + // Get the computed styles for the body element + const computedStyles = window.getComputedStyle(body); + + // Get the background color property + const bgColor = computedStyles.backgroundColor; + + // Set the background color in + document + .querySelector("meta[name='theme-color']") + ?.setAttribute("content", bgColor); + } +} + +// set early so no page flashes / CSS is made aware +reflectPreference(); + +window.onload = () => { + function setThemeFeature() { + // set on load so screen readers can get the latest value on the button + reflectPreference(); + + // now this script can find and listen for clicks on the control + document.querySelector("#theme-btn")?.addEventListener("click", () => { + themeValue = themeValue === "light" ? "dark" : "light"; + setPreference(); + }); + } + + setThemeFeature(); + + // Runs on view transitions navigation + document.addEventListener("astro:after-swap", setThemeFeature); +}; + +// sync with system changes +window + .matchMedia("(prefers-color-scheme: dark)") + .addEventListener("change", ({ matches: isDark }) => { + themeValue = isDark ? "dark" : "light"; + setPreference(); + }); diff --git a/remark-collapse.d.ts b/remark-collapse.d.ts new file mode 100644 index 0000000..2e0f26c --- /dev/null +++ b/remark-collapse.d.ts @@ -0,0 +1 @@ +declare module 'remark-collapse'; \ No newline at end of file diff --git a/src/assets/images/AstroPaper-v3.png b/src/assets/images/AstroPaper-v3.png new file mode 100644 index 0000000..7b96741 Binary files /dev/null and b/src/assets/images/AstroPaper-v3.png differ diff --git a/src/assets/images/AstroPaper-v4.png b/src/assets/images/AstroPaper-v4.png new file mode 100644 index 0000000..b4de557 Binary files /dev/null and b/src/assets/images/AstroPaper-v4.png differ diff --git a/src/assets/socialIcons.ts b/src/assets/socialIcons.ts new file mode 100644 index 0000000..db6ae33 --- /dev/null +++ b/src/assets/socialIcons.ts @@ -0,0 +1,211 @@ +const socialIcons = { + Github: ` + + + `, + Facebook: ` + + + `, + Instagram: ` + + + + + `, + LinkedIn: ` + + + + + + + `, + Mail: ` + + + + `, + X: ` + + + `, + Twitch: ` + + `, + YouTube: ` + + + `, + WhatsApp: ` + + + + `, + Snapchat: ` + + + `, + Pinterest: ` + + + + + `, + TikTok: ` + + + `, + CodePen: ` + + + + + + + + `, + Discord: ` + + + + + + + + `, + GitLab: ` + + + `, + Reddit: ` + + + + + + + + `, + Skype: ` + + + + `, + Steam: ` + + + + `, + Telegram: ` + + + `, + Mastodon: ` + + `, +}; + +export default socialIcons; diff --git a/src/components/Breadcrumbs.astro b/src/components/Breadcrumbs.astro new file mode 100644 index 0000000..70d5b55 --- /dev/null +++ b/src/components/Breadcrumbs.astro @@ -0,0 +1,72 @@ +--- +// Remove current url path and remove trailing slash if exists +const currentUrlPath = Astro.url.pathname.replace(/\/+$/, ""); + +// Get url array from path +// eg: /tags/tailwindcss => ['tags', 'tailwindcss'] +const breadcrumbList = currentUrlPath.split("/").slice(1); + +// if breadcrumb is Home > Posts > 1 +// replace Posts with Posts (page number) +breadcrumbList[0] === "posts" && + breadcrumbList.splice(0, 2, `Posts (page ${breadcrumbList[1] || 1})`); + +// if breadcrumb is Home > Tags > [tag] > [page] +// replace [tag] > [page] with [tag] (page number) +breadcrumbList[0] === "tags" && + !isNaN(Number(breadcrumbList[2])) && + breadcrumbList.splice( + 1, + 3, + `${breadcrumbList[1]} ${ + Number(breadcrumbList[2]) === 1 ? "" : "(page " + breadcrumbList[2] + ")" + }` + ); +--- + + + + diff --git a/src/components/Card.tsx b/src/components/Card.tsx new file mode 100644 index 0000000..711a252 --- /dev/null +++ b/src/components/Card.tsx @@ -0,0 +1,35 @@ +import { slugifyStr } from "@utils/slugify"; +import Datetime from "./Datetime"; +import type { CollectionEntry } from "astro:content"; + +export interface Props { + href?: string; + frontmatter: CollectionEntry<"blog">["data"]; + secHeading?: boolean; +} + +export default function Card({ href, frontmatter, secHeading = true }: Props) { + const { title, pubDatetime, modDatetime, description } = frontmatter; + + const headerProps = { + style: { viewTransitionName: slugifyStr(title) }, + className: "text-lg font-medium decoration-dashed hover:underline", + }; + + return ( +
  • + + {secHeading ? ( +

    {title}

    + ) : ( +

    {title}

    + )} +
    + +

    {description}

    +
  • + ); +} diff --git a/src/components/Datetime.tsx b/src/components/Datetime.tsx new file mode 100644 index 0000000..15238cb --- /dev/null +++ b/src/components/Datetime.tsx @@ -0,0 +1,120 @@ +import { LOCALE, SITE } from "@config"; +import type { CollectionEntry } from "astro:content"; + +interface DatetimesProps { + pubDatetime: string | Date; + modDatetime: string | Date | undefined | null; +} + +interface EditPostProps { + editPost?: CollectionEntry<"blog">["data"]["editPost"]; + postId?: CollectionEntry<"blog">["id"]; +} + +interface Props extends DatetimesProps, EditPostProps { + size?: "sm" | "lg"; + className?: string; +} + +export default function Datetime({ + pubDatetime, + modDatetime, + size = "sm", + className = "", + editPost, + postId, +}: Props) { + return ( +
    + + {modDatetime && modDatetime > pubDatetime ? ( + + Updated: + + ) : ( + Published: + )} + + + {size === "lg" && } + +
    + ); +} + +const FormattedDatetime = ({ pubDatetime, modDatetime }: DatetimesProps) => { + const myDatetime = new Date( + modDatetime && modDatetime > pubDatetime ? modDatetime : pubDatetime + ); + + const date = myDatetime.toLocaleDateString(LOCALE.langTag, { + year: "numeric", + month: "short", + day: "numeric", + }); + + const time = myDatetime.toLocaleTimeString(LOCALE.langTag, { + hour: "2-digit", + minute: "2-digit", + }); + + return ( + <> + + +  at  + {time} + + ); +}; + +const EditPost = ({ editPost, postId }: EditPostProps) => { + let editPostUrl = editPost?.url ?? SITE?.editPost?.url ?? ""; + const showEditPost = !editPost?.disabled && editPostUrl.length > 0; + const appendFilePath = + editPost?.appendFilePath ?? SITE?.editPost?.appendFilePath ?? false; + if (appendFilePath && postId) { + editPostUrl += `/${postId}`; + } + const editPostText = editPost?.text ?? SITE?.editPost?.text ?? "Edit"; + + return ( + showEditPost && ( + <> + + + + {editPostText} + + + ) + ); +}; diff --git a/src/components/Footer.astro b/src/components/Footer.astro new file mode 100644 index 0000000..887d810 --- /dev/null +++ b/src/components/Footer.astro @@ -0,0 +1,45 @@ +--- +import Hr from "./Hr.astro"; +import Socials from "./Socials.astro"; + +const currentYear = new Date().getFullYear(); + +export interface Props { + noMarginTop?: boolean; +} + +const { noMarginTop = false } = Astro.props; +--- + +
    +
    + +
    + + diff --git a/src/components/Header.astro b/src/components/Header.astro new file mode 100644 index 0000000..e0b1144 --- /dev/null +++ b/src/components/Header.astro @@ -0,0 +1,250 @@ +--- +import { LOGO_IMAGE, SITE } from "@config"; +import Hr from "./Hr.astro"; +import LinkButton from "./LinkButton.astro"; + +export interface Props { + activeNav?: "posts" | "archives" | "tags" | "about" | "search"; +} + +const { activeNav } = Astro.props; +--- + +
    + Skip to content + +
    +
    + + + + diff --git a/src/components/Hr.astro b/src/components/Hr.astro new file mode 100644 index 0000000..d7e835b --- /dev/null +++ b/src/components/Hr.astro @@ -0,0 +1,12 @@ +--- +export interface Props { + noPadding?: boolean; + ariaHidden?: boolean; +} + +const { noPadding = false, ariaHidden = true } = Astro.props; +--- + +
    +
    +
    diff --git a/src/components/LinkButton.astro b/src/components/LinkButton.astro new file mode 100644 index 0000000..69cf114 --- /dev/null +++ b/src/components/LinkButton.astro @@ -0,0 +1,38 @@ +--- +export interface Props { + href: string; + className?: string; + ariaLabel?: string; + title?: string; + disabled?: boolean; +} + +const { + href, + className = "", + ariaLabel, + title, + disabled = false, +} = Astro.props; +--- + +{ + disabled ? ( + + + + ) : ( + + + + ) +} diff --git a/src/components/Pagination.astro b/src/components/Pagination.astro new file mode 100644 index 0000000..282fb5c --- /dev/null +++ b/src/components/Pagination.astro @@ -0,0 +1,59 @@ +--- +import type { Page } from "astro"; +import LinkButton from "./LinkButton.astro"; +import type { CollectionEntry } from "astro:content"; + +export interface Props { + page: Page>; +} + +const { page } = Astro.props; +--- + +{ + page.lastPage > 1 && ( + + ) +} + + diff --git a/src/components/Search.tsx b/src/components/Search.tsx new file mode 100644 index 0000000..9c5fd76 --- /dev/null +++ b/src/components/Search.tsx @@ -0,0 +1,120 @@ +import Fuse from "fuse.js"; +import { useEffect, useRef, useState, useMemo, type FormEvent } from "react"; +import Card from "@components/Card"; +import type { CollectionEntry } from "astro:content"; + +export type SearchItem = { + title: string; + description: string; + data: CollectionEntry<"blog">["data"]; + slug: string; +}; + +interface Props { + searchList: SearchItem[]; +} + +interface SearchResult { + item: SearchItem; + refIndex: number; +} + +export default function SearchBar({ searchList }: Props) { + const inputRef = useRef(null); + const [inputVal, setInputVal] = useState(""); + const [searchResults, setSearchResults] = useState( + null + ); + + const handleChange = (e: FormEvent) => { + setInputVal(e.currentTarget.value); + }; + + const fuse = useMemo( + () => + new Fuse(searchList, { + keys: ["title", "description"], + includeMatches: true, + minMatchCharLength: 2, + threshold: 0.5, + }), + [searchList] + ); + + useEffect(() => { + // if URL has search query, + // insert that search query in input field + const searchUrl = new URLSearchParams(window.location.search); + const searchStr = searchUrl.get("q"); + if (searchStr) setInputVal(searchStr); + + // put focus cursor at the end of the string + setTimeout(function () { + inputRef.current!.selectionStart = inputRef.current!.selectionEnd = + searchStr?.length || 0; + }, 50); + }, []); + + useEffect(() => { + // Add search result only if + // input value is more than one character + const inputResult = inputVal.length > 1 ? fuse.search(inputVal) : []; + setSearchResults(inputResult); + + // Update search string in URL + if (inputVal.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + searchParams.set("q", inputVal); + const newRelativePathQuery = + window.location.pathname + "?" + searchParams.toString(); + history.replaceState(history.state, "", newRelativePathQuery); + } else { + history.replaceState(history.state, "", window.location.pathname); + } + }, [inputVal]); + + return ( + <> + + + {inputVal.length > 1 && ( +
    + Found {searchResults?.length} + {searchResults?.length && searchResults?.length === 1 + ? " result" + : " results"}{" "} + for '{inputVal}' +
    + )} + +
      + {searchResults && + searchResults.map(({ item, refIndex }) => ( + + ))} +
    + + ); +} diff --git a/src/components/ShareLinks.astro b/src/components/ShareLinks.astro new file mode 100644 index 0000000..e453222 --- /dev/null +++ b/src/components/ShareLinks.astro @@ -0,0 +1,66 @@ +--- +import LinkButton from "./LinkButton.astro"; +import socialIcons from "@assets/socialIcons"; + +const URL = Astro.url; + +const shareLinks = [ + { + name: "WhatsApp", + href: "https://wa.me/?text=", + linkTitle: `Share this post via WhatsApp`, + }, + { + name: "Facebook", + href: "https://www.facebook.com/sharer.php?u=", + linkTitle: `Share this post on Facebook`, + }, + { + name: "X", + href: "https://x.com/intent/post?url=", + linkTitle: `Share this post on X`, + }, + { + name: "Telegram", + href: "https://t.me/share/url?url=", + linkTitle: `Share this post via Telegram`, + }, + { + name: "Pinterest", + href: "https://pinterest.com/pin/create/button/?url=", + linkTitle: `Share this post on Pinterest`, + }, + { + name: "Mail", + href: "mailto:?subject=See%20this%20post&body=", + linkTitle: `Share this post via email`, + }, +] as const; +--- + +
    + Share this post on: +
    + { + shareLinks.map(social => ( + + + {social.linkTitle} + + )) + } +
    +
    + + diff --git a/src/components/Socials.astro b/src/components/Socials.astro new file mode 100755 index 0000000..54832f9 --- /dev/null +++ b/src/components/Socials.astro @@ -0,0 +1,35 @@ +--- +import { SOCIALS } from "@config"; +import LinkButton from "./LinkButton.astro"; +import socialIcons from "@assets/socialIcons"; + +export interface Props { + centered?: boolean; +} + +const { centered = false } = Astro.props; +--- + +
    + { + SOCIALS.filter(social => social.active).map(social => ( + + + {social.linkTitle} + + )) + } +
    + + diff --git a/src/components/Tag.astro b/src/components/Tag.astro new file mode 100644 index 0000000..5a4a376 --- /dev/null +++ b/src/components/Tag.astro @@ -0,0 +1,38 @@ +--- +export interface Props { + tag: string; + size?: "sm" | "lg"; +} + +const { tag, size = "sm" } = Astro.props; +--- + +
  • + + + +  {tag} + +
  • + + diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..82e8f55 --- /dev/null +++ b/src/config.ts @@ -0,0 +1,155 @@ +import type { Site, SocialObjects } from "./types"; + +export const SITE: Site = { + website: "https://tiff.engineer/", // replace this with your deployed domain + author: "tiff w", + profile: "https://about.tiff.engineer/", + desc: "A software blog by someone named tiff.", + title: "tiff on software", + ogImage: "astropaper-og.jpg", + lightAndDarkMode: true, + postPerIndex: 4, + postPerPage: 3, + scheduledPostMargin: 15 * 60 * 1000, // 15 minutes + showArchives: true, + editPost: { + url: "https://github.com/satnaing/astro-paper/edit/main/src/content/blog", + text: "Suggest Changes", + appendFilePath: true, + }, +}; + +export const LOCALE = { + lang: "en", // html lang code. Set this empty and default will be "en" + langTag: ["en-EN"], // BCP 47 Language Tags. Set this empty [] to use the environment default +} as const; + +export const LOGO_IMAGE = { + enable: false, + svg: true, + width: 216, + height: 46, +}; + +export const SOCIALS: SocialObjects = [ + { + name: "Github", + href: "https://github.com/satnaing/astro-paper", + linkTitle: ` ${SITE.title} on Github`, + active: true, + }, + { + name: "Facebook", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Facebook`, + active: true, + }, + { + name: "Instagram", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Instagram`, + active: true, + }, + { + name: "LinkedIn", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on LinkedIn`, + active: true, + }, + { + name: "Mail", + href: "mailto:yourmail@gmail.com", + linkTitle: `Send an email to ${SITE.title}`, + active: false, + }, + { + name: "X", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on X`, + active: false, + }, + { + name: "Twitch", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Twitch`, + active: false, + }, + { + name: "YouTube", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on YouTube`, + active: false, + }, + { + name: "WhatsApp", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on WhatsApp`, + active: false, + }, + { + name: "Snapchat", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Snapchat`, + active: false, + }, + { + name: "Pinterest", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Pinterest`, + active: false, + }, + { + name: "TikTok", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on TikTok`, + active: false, + }, + { + name: "CodePen", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on CodePen`, + active: false, + }, + { + name: "Discord", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Discord`, + active: false, + }, + { + name: "GitLab", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on GitLab`, + active: false, + }, + { + name: "Reddit", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Reddit`, + active: false, + }, + { + name: "Skype", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Skype`, + active: false, + }, + { + name: "Steam", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Steam`, + active: false, + }, + { + name: "Telegram", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Telegram`, + active: false, + }, + { + name: "Mastodon", + href: "https://github.com/satnaing/astro-paper", + linkTitle: `${SITE.title} on Mastodon`, + active: false, + }, +]; diff --git a/src/content/blog/back-again.md b/src/content/blog/back-again.md new file mode 100644 index 0000000..59eadcb --- /dev/null +++ b/src/content/blog/back-again.md @@ -0,0 +1,39 @@ +--- +pubDatetime: 2024-10-18 +title: Back Again +description: "Life is uncertain, but one thing remains constant- my need to keep my brain engaged." +featured: false +--- + +> This is going to be a brief post; I have not gathered my thoughts on my current career situation, however that will come. + +## What's Up? + +Well, I've given up on pivoting to cybersecurity. I have also given up on IT/DevOps as a career. I will be talking about this +more in another post somewhere else which I'll link to, but it is what it is for me. + +This means I have more time to build software when I get a chance and for fun and for my next endeavour which means +this blog is my main one for software dev for the foreseeable future. + +I am glad to consolidate things and pare things down to just this blog and my next endeavour [Tiff Labs](https://tifflabs.org). + +## What is Tiff Labs? + +First, I've quit trying to have a career in tech proper. It's just not going to happen for someone my age during a recession +like this. I don't have a degree and am fully self-taught. This is a big strike against me returning to the workforce in tech and +if I can't do that, I will do my own thing. I have income from other sources to be able to do this so I am not too concerned about +making ends meet for now. + +Tiff Labs is an umbrella of things- a YouTube channel, a blog, a smart home resource, and a homelab resource. I can make money from that once I get more content up and posted[^1]. + +I will also be doing more DIY repairing of devices and DIY building of things in general. I enjoy working with my hands more than working with code. I love both, don't get me wrong. However working with my hands gives me immense joy I don't find while writing software. + +## What this blog will be + +It will be a place for me to talk about the software I build for my other projects and hopefully a small business at some point. That's it. + +Here is a project I'd like to build in Go: + +
    Comment
    byu/TheBrownViking20 from discussion
    ingolang
    + +[^1]: I know that affiliate links are frowned upon but other than ads which I don't want to run, this will have to do for now. diff --git a/src/content/blog/designing-projects.md b/src/content/blog/designing-projects.md new file mode 100644 index 0000000..3a3e116 --- /dev/null +++ b/src/content/blog/designing-projects.md @@ -0,0 +1,7 @@ +--- +title: Designing projects +pubDatetime: 2024-12-24 +description: Listless and needing focus, I found the perfect repo to build my skills. +featured: true +draft: true +--- diff --git a/src/content/blog/go-project-structure.md b/src/content/blog/go-project-structure.md new file mode 100644 index 0000000..d191500 --- /dev/null +++ b/src/content/blog/go-project-structure.md @@ -0,0 +1,10 @@ +--- +pubDatetime: 2024-04-01 +title: Go Project Structure for gURL +description: Helpful Go tip. +featured: true +--- + +Over the past week I've been working on changing the structure of gURL. + +One of my old CodeNewbie friends on LinkedIn gave me a template to start from on GitHub called [Standard Go Project Layout](https://github.com/golang-standards/project-layout). I intend to use this as a guide. diff --git a/src/content/blog/gurl-cli.md b/src/content/blog/gurl-cli.md new file mode 100644 index 0000000..78897f1 --- /dev/null +++ b/src/content/blog/gurl-cli.md @@ -0,0 +1,80 @@ +--- +pubDatetime: 2024-03-24 +title: "gURL: A cURL Wrapper Written in Go" +description: Moving on from frontend to something new. +featured: true +--- + +Briefly: I am writing a CLI tool that fetches info from GitHub's REST API as a wrapper around cURL. + +Why? + +Just to keep my finger on the pulse of software development and to practice my programming skills because believe it or not, being able to code as a cybersecurity professional is extremely useful, even though it isn't _technically necessary_. + +I'm currently wading though documentation on Go modules and Go standard library packages, as well as reading other code examples to see how I want to structure my application. + +First, I found a [repo that](https://github.com/wick3dr0se/github-api-curl/tree/master) uses shell scripts to wrap around the GitHub API. This gave me the idea for splitting up my tool into different directories. + +Then, I fiddled around with [Google's GitHub Go library](https://github.com/google/go-github/tree/master) to see how they used Go to build the library. + +## Fits and Starts + +My first inkling was to crib this code from the Google repo: + +```go +var defaultBaseURL = "https://github.com/" + +// Client is a GitHub scraping client. +type Client struct { + *http.Client + + // base URL for github.com pages. Exposed primarily for testing. Also + // used for saving and restoring cookies on the Client. + baseURL *url.URL +} +``` + +I wasn't exactly sure what I was looking at; I have a `baseURL` variable that is assigned the GitHub url. I've imported the `net/http` package, as it would have been in this example. We have a `Client` type that is also a `struct` which I have forgetten what they are exactly, as it has been a while since I've read the C++ docs, which also has a `struct` but I think that `struct` in this instance has the `type` keyword to denote that it is a `class` or something. + +In any case, I was trying to figure out how to use string interpolation in the URL parameters like you would in JavaScript template strings: + +```js +// Octokit.js +// https://github.com/octokit/core.js#readme +const octokit = new Octokit({ + auth: "YOUR-TOKEN", +}); + +// the request method contains template strings which is +// JavaScript's way of doing string interpolation + +await octokit.request("GET /repos/{owner}/{repo}", { + owner: "OWNER", + repo: "REPO", + headers: { + "X-GitHub-Api-Version": "2022-11-28", + }, +}); +``` + +How does that work in Go? + +At first I was thinking of using `Stripln()` to do string interpolation but as a [StackOverflow user said](https://stackoverflow.com/a/71181938/3800146), to put that junk in a query parameter would be messy and unsafe. The user suggested the op use the `net/http` library which solves all the issues I'd face trying to make `GET` requests to GitHub's REST API. + +The example given: + +```go +params := url.Values{ + "page[size]": []string{"100"}, + "page[" + key + "]": []string{"1"}, +} +u := &url.URL{ + Scheme: "https", + Host: "url.com", + Path: "/path", + RawQuery: params.Encode(), +} +req, err := http.NewRequest("GET", u.String(), nil) +``` + +This should do it for now. diff --git a/src/content/blog/hello.md b/src/content/blog/hello.md new file mode 100644 index 0000000..870c0c7 --- /dev/null +++ b/src/content/blog/hello.md @@ -0,0 +1,15 @@ +--- +pubDatetime: 2024-03-17 +title: "Hello, y'all" +description: Introductions. +--- + +This is a learning and accountability blog. + +This is my first post. It will be updated as time permits. + +One of the things frustrating me lately is when I was just starting out, I blogged about literally everything; the industry was new to me and everyone was excited, I was excited at the possibility of pulling myself out of extreme poverty. I was younger, bright-eyed, without any cynicism. + +Fast forward 10 years and a lot has changed. I won't get into the gory details but y'all know. Tech is not what it used to be, I've grown to despise most JavaScript anything, and I'm an industry vet who is disillusioned by the state of the industry and the world in general. That kind of pessimism weighs on me daily, so much so I don't write about anything I learn. It sucks. + +So this is my blog post I'm sending you, I hope you read it. (Bonus points is you get that reference). diff --git a/src/content/blog/this-week-update.md b/src/content/blog/this-week-update.md new file mode 100644 index 0000000..d600754 --- /dev/null +++ b/src/content/blog/this-week-update.md @@ -0,0 +1,26 @@ +--- +pubDatetime: 2024-04-23 +title: This Week's Update +description: Brief note. +featured: true +--- + +Things I have been up to while off LinkedIn: + +- Working on my [home lab](http://homelab.tifflabs.org) by setting up k3s for High Availabilty servers for critical services in the lab +- Learning more about VMs, [Nginx](https://notes.0x8c.org/home-lab/nginx-configs/), and Reverse Proxies +- Learning about [Certbot](https://certbot.eff.org/) +- Failing to set up [TWO "beginner-friendly"](https://github.com/tobychui/zoraxy) [reverse proxy managers](https://nginxproxymanager.com/) and realizing that [learning how to use the CLI more](https://lemmy.brendan.ie/comment/223126) is the best course of action +- Learning how to [reconfigure Proxmox IP addresses](https://gist.github.com/twhite96/2ed4c6f3d50ed0009947c69e7bded6ca), failing to keep the cluster, and wiping three nodes clean +- Deciding that I'd keep one node out of the cluster for having one less entrypoint to my network[^1] +- Setting up InfluxDB for use of monitoring my Proxmox cluster and separate node in Grafana +- Learning Linux commands such as `fstab`, `lsblk`, and that you can pretty much do everything you need system wide (rebooting, etc), by prefixing `systemctl` to those commands +- Creating my own Docker image and container to fix a bug in a repo I want to use but want it to install dependencies and "just work", as they say +- Installing a self-hosted Git client/website +- Learning that `ini` files are basically the same as `toml` files +- Researching how to use WebSockets in Python or Go to understand how someone could use that to exploit a website/machine by keeping the socket alive and using the website/machine as a C2 server +- Working on creating my own C2 server + +I've been at it nonstop these past two weeks, but I am having serious fun. + +[^1]: I have too many VMs and LXCs now or I'd change the IP to help with this as well. diff --git a/src/content/config.ts b/src/content/config.ts new file mode 100644 index 0000000..dadf97a --- /dev/null +++ b/src/content/config.ts @@ -0,0 +1,36 @@ +import { SITE } from "@config"; +import { glob } from "astro/loaders"; +import { defineCollection, z } from "astro:content"; + +const blog = defineCollection({ + type: "content_layer", + loader: glob({ pattern: "**/*.md", base: "./src/content/blog" }), + schema: ({ image }) => + z.object({ + author: z.string().default(SITE.author), + pubDatetime: z.date(), + modDatetime: z.date().optional().nullable(), + title: z.string(), + featured: z.boolean().optional(), + draft: z.boolean().optional(), + tags: z.array(z.string()).default(["others"]), + ogImage: image() + .refine(img => img.width >= 1200 && img.height >= 630, { + message: "OpenGraph image must be at least 1200 X 630 pixels!", + }) + .or(z.string()) + .optional(), + description: z.string(), + canonicalURL: z.string().optional(), + editPost: z + .object({ + disabled: z.boolean().optional(), + url: z.string().optional(), + text: z.string().optional(), + appendFilePath: z.boolean().optional(), + }) + .optional(), + }), +}); + +export const collections = { blog }; diff --git a/src/env.d.ts b/src/env.d.ts new file mode 100644 index 0000000..acef35f --- /dev/null +++ b/src/env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/src/layouts/AboutLayout.astro b/src/layouts/AboutLayout.astro new file mode 100644 index 0000000..9f6dbc0 --- /dev/null +++ b/src/layouts/AboutLayout.astro @@ -0,0 +1,28 @@ +--- +import { SITE } from "@config"; +import Breadcrumbs from "@components/Breadcrumbs.astro"; +import Footer from "@components/Footer.astro"; +import Header from "@components/Header.astro"; +import Layout from "./Layout.astro"; + +export interface Props { + frontmatter: { + title: string; + description?: string; + }; +} + +const { frontmatter } = Astro.props; +--- + + +
    + +
    +
    +

    {frontmatter.title}

    + +
    +
    +