Site code: site-wide CSS and JavaScript
For users
What it is for
The Site code tab holds code that runs on every page and every language of your site: site CSS, site JavaScript, and links to external stylesheets and scripts. Use it for anything that should look or work the same everywhere, for example styles for the header and footer, or a live-chat widget that must appear on all pages.
Use the page's own Code (HTML/CSS/JS) only for things that belong to one page. See Page code.
Where
SufiCMS → Site settings (/panel/admin/cms/site) → tab Site code (fa: «کد سایت»).
Fields on the tab
| Field | What goes there | When it goes live |
|---|---|---|
| CSS | Site-wide styles | After Publish |
| JavaScript | Site-wide script (runs on every page) | After Publish |
| External scripts | URLs of script files hosted elsewhere | Immediately on save; the tab says changes apply to the live site immediately |
Buttons: Save draft, Publish, and a revisions list.
Steps: change site CSS or JavaScript
- Open Site settings → Site code. Reload the page first if it has been open for a while.
- Copy the current field content to a safe place (your backup).
- Edit the CSS or JavaScript field.
- Click Save draft. Wait until saving finishes; do not save while a reconnect banner is showing.
- Re-open the tab and check the saved content is complete.
- Click Publish. If nothing happens, click again after a moment (the first click after a reload is sometimes ignored).
- Open the live site in a private window, in each language, and check the change.
Tips
- Site code is not per language. One version serves fa, en, ar and es. If a rule must differ by language, write it with
:dir(rtl),[dir="rtl"]or[lang="fa"]selectors. - Styles saved on a partial (header/footer) are saved and published but never reach the live site. Put header and footer styles in Site CSS instead.
- If you move a script from a page to Site code (for example the chat widget), remove it from the page, or it will load twice on that page.
- Keep your own copy of every version you publish. The revisions list can help, but a local copy is the fastest rollback.