Skip to content

add array of sections for blogpost#1536

Merged
guitavano merged 2 commits intomainfrom
tavano/blog-support-sections
Mar 4, 2026
Merged

add array of sections for blogpost#1536
guitavano merged 2 commits intomainfrom
tavano/blog-support-sections

Conversation

@guitavano
Copy link
Contributor

@guitavano guitavano commented Feb 26, 2026

What is this Contribution About?

Please provide a brief description of the changes or enhancements you are proposing in this pull request.

Issue Link

Please link to the relevant issue that this pull request addresses:

Loom Video

Record a quick screencast describing your changes to help the team understand and review your contribution. This will greatly assist in the review process.

Demonstration Link

Provide a link to a branch or environment where this pull request can be tested and seen in action.


Summary by cubic

Add support for multiple post sections (Deco blocks) rendered after the main content, and make main content optional. Also link /styles.css in the blog template and remove the external image optimization console warning.

Written for commit b344dd4. Summary will update on new commits.

Summary by CodeRabbit

  • New Features

    • Blog posts now support multiple customizable content sections with external stylesheet linking for enhanced layout flexibility and content organization.
    • Blog content structure now enables more modular layouts through optional main content and section-based designs.
  • Bug Fixes

    • Removed unnecessary console warning that appeared during image optimization for external sources.

@github-actions
Copy link
Contributor

Tagging Options

Should a new tag be published when this PR is merged?

  • 👍 for Patch 0.135.4 update
  • 🎉 for Minor 0.136.0 update
  • 🚀 for Major 1.0.0 update

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

Three files modified to extend blog post functionality with optional sections rendering support and update image component warning behavior. Blog template now renders sections via stylesheet-injected content container, while types interface makes content optional and adds sections property. Image component removes optimization warning output.

Changes

Cohort / File(s) Summary
Blog Sections Feature
blog/sections/Template.tsx, blog/types.ts
Added support for rendering multiple sections in blog posts. Template destructures new sections field and renders them via renderSection in a new "content-sections" container. BlogPost interface makes content optional and introduces optional Section[] array property.
Image Optimization Warning Removal
website/components/Image.tsx
Removed runtime console.warn that warned when automatic image optimization was disabled for external sources. Eliminated guarded warning block without affecting functional behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • aka-sacci-ccr

Poem

🐰 A happy hop through sections new,
Optional content, fresh and true,
Warnings whisked from Image's call,
Blog posts dancing down the hall!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete; it contains only the template placeholder text without filling in required sections like contribution details, issue link, Loom video, or demonstration link. Replace template placeholders with actual content: describe the changes, link the relevant issue, provide a Loom screencast, and include a demonstration link or branch.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'add array of sections for blogpost' directly and clearly describes the main change: adding a sections array property to blog posts.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tavano/blog-support-sections

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
blog/sections/Template.tsx (1)

45-45: Ensure content is sanitized before rendering.

The static analysis correctly flags dangerouslySetInnerHTML as a potential XSS vector. While this is a common pattern for CMS/blog content, ensure the content field is sanitized server-side or at ingestion time before being stored and rendered.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@blog/sections/Template.tsx` at line 45, The JSX uses dangerouslySetInnerHTML
with the variable content in Template.tsx which is an XSS risk; ensure content
is sanitized before rendering by applying a server-side/ingestion sanitization
step (or a trusted-sanitizer function) so only safe HTML is stored and returned,
and update any render-time code that uses dangerouslySetInnerHTML to only accept
sanitized/trusted content (referencing the dangerouslySetInnerHTML usage and the
content variable).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@blog/sections/Template.tsx`:
- Around line 46-48: The markup for the content container has inconsistent
indentation around the div with class "content-sections" and the JSX expression
using sections?.map(renderSection); run the project's formatter (deno fmt) and
fix the indentation so the JSX lines align with surrounding code, ensuring the
div element containing sections?.map(renderSection) and the renderSection
reference are indented consistently with the rest of Template.tsx; after
formatting, re-run CI to verify the pipeline passes.
- Line 24: Remove the hardcoded stylesheet link tag from the Template component:
delete the "<link href=\"/styles.css\" rel=\"stylesheet\"/>" element in
blog/sections/Template.tsx (it is redundant because CSS is injected inline from
blog/static/css.ts), ensuring only the inline injection on the following line
remains.

---

Nitpick comments:
In `@blog/sections/Template.tsx`:
- Line 45: The JSX uses dangerouslySetInnerHTML with the variable content in
Template.tsx which is an XSS risk; ensure content is sanitized before rendering
by applying a server-side/ingestion sanitization step (or a trusted-sanitizer
function) so only safe HTML is stored and returned, and update any render-time
code that uses dangerouslySetInnerHTML to only accept sanitized/trusted content
(referencing the dangerouslySetInnerHTML usage and the content variable).

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7753c3 and b0f71c7.

📒 Files selected for processing (3)
  • blog/sections/Template.tsx
  • blog/types.ts
  • website/components/Image.tsx
💤 Files with no reviewable changes (1)
  • website/components/Image.tsx


return (
<>
<link href="/styles.css" rel="stylesheet"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's look at the file mentioned in the review
cat -n blog/sections/Template.tsx

Repository: deco-cx/apps

Length of output: 1650


🏁 Script executed:

# Check if styles.css actually exists in the repository
find . -name "styles.css" -o -name "styles.*" | head -20

Repository: deco-cx/apps

Length of output: 38


🏁 Script executed:

# Search for all references to styles.css across the codebase
rg -n "styles\.css" --type=ts --type=tsx --type=jsx --type=js -C 2

Repository: deco-cx/apps

Length of output: 83


🏁 Script executed:

# Search for other stylesheet references to understand the pattern
rg -n "href.*stylesheet|import.*css" --type=ts --type=tsx --type=jsx --type=js | head -20

Repository: deco-cx/apps

Length of output: 83


🏁 Script executed:

# Check if there's a public or static directory structure
find . -type d -name "public" -o -type d -name "static" -o -type d -name "styles" | head -10

Repository: deco-cx/apps

Length of output: 69


🏁 Script executed:

# Look for configuration files that might handle static assets or stylesheets
git ls-files | grep -E "(next\.config|webpack|tsconfig|vite|rollup|package\.json)" | head -10

Repository: deco-cx/apps

Length of output: 38


🏁 Script executed:

# Look at the static/css.ts file to understand the CSS strategy
cat -n blog/static/css.ts

Repository: deco-cx/apps

Length of output: 4524


🏁 Script executed:

# Search for any build or public configuration files
git ls-files | grep -E "(package\.json|deno\.json|tsconfig|build|vite|webpack)" | head -20

Repository: deco-cx/apps

Length of output: 724


🏁 Script executed:

# Check if styles.css is referenced in any config or build scripts
rg -n "styles\.css" -i --max-count=20

Repository: deco-cx/apps

Length of output: 135


🏁 Script executed:

# Look for public directory or static asset configuration
find . -type d -name "public" | head -5

Repository: deco-cx/apps

Length of output: 38


Remove the hardcoded stylesheet link; it references a non-existent file.

The /styles.css path at line 24 does not exist in the repository and is completely redundant. The CSS is already being injected inline from blog/static/css.ts on line 25. Remove the <link href="/styles.css" rel="stylesheet"/> tag to eliminate the 404 error.

🧰 Tools
🪛 ast-grep (0.41.0)

[warning] 24-24: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation [REFERENCES]
- https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
- https://cwe.mitre.org/data/definitions/79.html

(react-unsafe-html-injection)

🪛 GitHub Actions: ci

[error] 24-24: deno fmt --check reported not formatted changes in this file. Run 'deno fmt' or 'deno fmt --check' again after formatting.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@blog/sections/Template.tsx` at line 24, Remove the hardcoded stylesheet link
tag from the Template component: delete the "<link href=\"/styles.css\"
rel=\"stylesheet\"/>" element in blog/sections/Template.tsx (it is redundant
because CSS is injected inline from blog/static/css.ts), ensuring only the
inline injection on the following line remains.

Comment on lines +46 to +48
<div class="content-sections">
{sections?.map(renderSection)}
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix formatting: inconsistent indentation.

The pipeline is failing due to formatting issues. The indentation inside this div is inconsistent with the rest of the file.

🔧 Proposed fix
         <div dangerouslySetInnerHTML={{ __html: content as string }} />
         <div class="content-sections">
-              {sections?.map(renderSection)}
-            </div>
+          {sections?.map(renderSection)}
+        </div>
       </div>

Run deno fmt to auto-fix the formatting issues flagged by the CI pipeline.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<div class="content-sections">
{sections?.map(renderSection)}
</div>
<div class="content-sections">
{sections?.map(renderSection)}
</div>
🧰 Tools
🪛 GitHub Actions: ci

[error] 47-48: deno fmt --check indicated formatting changes in this region. Please format the file.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@blog/sections/Template.tsx` around lines 46 - 48, The markup for the content
container has inconsistent indentation around the div with class
"content-sections" and the JSX expression using sections?.map(renderSection);
run the project's formatter (deno fmt) and fix the indentation so the JSX lines
align with surrounding code, ensuring the div element containing
sections?.map(renderSection) and the renderSection reference are indented
consistently with the rest of Template.tsx; after formatting, re-run CI to
verify the pipeline passes.

@guitavano guitavano merged commit cafc23d into main Mar 4, 2026
1 of 2 checks passed
@guitavano guitavano deleted the tavano/blog-support-sections branch March 4, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant