i want use css in wiki.js,how to do it?

2.1k Views Asked by At

I am using lastest version of wiki.js. I want write html page on code mode,the page include css js,I upload css js files to wiki.js but I can'nt load in css stylesheet in html page. if I paste in css page , that will be load.

so my question is how can I load css file in wiki.js html page?

can use css file in wiki.js code mode

1.I upload my css to http://14.29.194.205:3080/1.css

2.My html code like that enter image description here

3.when i refresh my page http://14.29.194.205:3080/

enter image description here

2

There are 2 best solutions below

1
Kunjesh Ramani On

Yes, you can use CSS files in Wiki.js HTML pages. Here are the steps you can follow to load CSS files in Wiki.js:

Upload your CSS file to Wiki.js: Go to the "Files" section in the sidebar, click on "Upload file" and select your CSS file.

Copy the link to your CSS file: After uploading the CSS file, click on it to open it, then copy the link in the "URL" field.

Add a link to your CSS file in your HTML code:

<head>
  <link rel="stylesheet" href="https://your-wiki-js-url.com/files/your-css-file.css">
</head>

Replace "https://your-wiki-js-url.com" with the URL of your Wiki.js instance, and "your-css-file.css" with the name of your CSS file.

Save your HTML page: Save your HTML page and refresh it. Your CSS file should now be loaded. Note that you cannot use external CSS files in Wiki.js code mode. You can only use inline CSS styles. To use inline CSS styles, you can add a "style" attribute to your HTML tags, like this:

<div style="color: red; font-size: 18px;">This text is red and 18px</div>

I hope this helps! Let me know if you have any other questions.

0
RobCole On

Here is the latest that we found in wiki.js:

When you are editing your page, click on the "Page" link in the top-right. In the Page Properties window that opens, click on the "Styles" in the top-right. This opens a page that is titled "css" and includes some information about how the css is stored when you click on "OK".

We copied our CSS into this Styles window and styles are applied in whatever editor we are using (most of our pages are Markdown, but a few are HTML). Unfortunately, we needed to copy the CSS into the Styles for each page.

The answer from @Kunjesh Ramani should allow you to include a single CSS file in multiple pages.