Generate static file in discourse

Hi,

I want to know how to upload a static file, and make this file public for all guest download.
Do I need the admin permission? or normal user can upload it ?

Please give us the feedback,
Thanks,
Caesar

1 Like

There isn’t an easy way.

What problem is that solving?

You might check out Page Publishing.

1 Like

Thanks for the reply, but in my hope, I want to write down or upload a CSS or pure text in the discourse without any style.

It seems the publish post with the default styling, not pure text.

I might be misunderstanding, but do you want it formatted as code and not standard text?

html {
  background: red;
}

You can do that by surrounding your CSS with backticks like this:

```css
html {
background: red;
}
```

2 Likes

Maybe there is a little misunderstanding, my expectation like user enter the public link can see totally pure text, for example,

https://raw.githubusercontent.com/hakimel/css/master/device-loop/style.css

How can I do this by publishing post or any suggestion?

I’m still not clear just what you want, but perhaps you want to allow users to upload other file types? To do that you’d add to the authorized extensions site setting.

But if you want Discourse to serve a file like the github link that you linked to, I’m not aware of a way to have a user do that. (I’m not quite sure what happens if you make css an authorized extension–I think that the browser will download rather than render the page).

1 Like

thanks everyone reply, seem that can not reach, i still need to install the Sitemap | Discourse - Civilized Discussion

If you are on our hosting, sitemap is a business level plugin – it’s not offered on the standard tier.