Questions tagged [astro]

Astro is an all-in-one web framework for building fast, content-focused websites. More info can be found here: https://astro.build/

Astro is an all-in-one web framework for building fast, content-focused websites.
More info can be found here: https://astro.build/

252 questions
2
votes
0 answers

How do I render embedded code blocks from Contentful with Prism in Astro?

I decided to try out Astro by building a web development blog integrated with contentful. I got everything working except for the code blocks. I create an embedded entry for the code block in my content model, which returns the following…
2
votes
2 answers

Using `await` within a .map works but seems to skip the parent's `await` functionality

I have an rss.xml.js file that runs this script in a project using the astro framework. import rss from "@astrojs/rss"; import { fetchFeed } from "../lib/api"; export async function get(context) { const posts = await fetchFeed(); return rss({ …
Alim Bolar
  • 479
  • 4
  • 17
2
votes
2 answers

Dynamically import all images from a folder in Astro

I am working with Astro. The project uses quite a few images, and I want to simplify the way I currently add new images. My routes are like: example.com/pictures/[collection] ( "[" and "]" stands for a dynamic route ) Allowing for…
2
votes
2 answers

What's the best way to pass markdown to an Astro component as a prop

What I'm trying to do A simple way to render the content of a markdown file when it's passed as a string to another component using .compiledContent (or even using .rawContnent)? Or even a better way than this as obviously usually in Astro we can…
Lushawn
  • 522
  • 1
  • 3
  • 17
2
votes
1 answer

Astro - react useEffect hook is not working

I am trying to build a web app with Astro + Reactjs, but I got an issue on calling useEffect. Basically useEffect is not calling, I don't get any logs in the terminal or any warnings/errors in the terminal or in the browser. I am exporting the…
cucereanum
  • 43
  • 8
2
votes
1 answer

How to use Astro with WASM in TypeScript

I would like to use a Web-Assembly Module that I wrote in Rust in my Astro App. I am using TypeScript and the following astro.config.mjs: import { defineConfig } from "astro/config"; import wasm from "vite-plugin-wasm"; import topLevelAwait from…
Tadeo Hepperle
  • 550
  • 2
  • 12
2
votes
0 answers

Astro in Docker not refresh

I am creating an Astro js container with Docker on windows. Dockerfile FROM node:18-alpine3.15 RUN mkdir app WORKDIR /app COPY . . RUN npm install EXPOSE 24678 CMD ["npm","run","dev","--","--host"] I build my image with the following command docker…
SaulRM
  • 121
  • 5
1
vote
1 answer

Close dropdown button when clicking outside but with good performance

I've been trying to make a dropdown button that it disactivates when clicking outside of it but I have not find good solution that has good performance, I am making the website with the Astro Framework so this is an example of what I want it to be…
1
vote
2 answers

Astro: browser or server side?

How to detect if astro rendering happens in browser or on the server side? Found no info in official reference and troubleshooting guide. The only 'advice' I found is to use 'client:only'. UPDATE Solution found export const isCLientSide =…
Dmitry Kaigorodov
  • 1,512
  • 18
  • 27
1
vote
1 answer

Astro: How do I call a function inside the script from onclick in a button?

Here is my example. How to call greeting() function from the button? Please help me, thanks! --- import Layout from "@layouts/Layout.astro"; const greeting = () => { console.log("Hello, server"); }; ---
Thuong Vu
  • 53
  • 1
  • 7
1
vote
1 answer

how to pass variable from frontmatter to script in Astro JS?

How to pass variable from frontmatter to script in Astro js. Like this: --- const title = "this is title" --- some content