Add script to post

Asked

Viewed 88 times

0

I’m creating a free website on https://wordpress.com/

My intention is to add codes, and for this, I would like to use the Highlight.js

My attempt was to add via CDN:

<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.10.0/styles/default.min.css">
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.10.0/highlight.min.js"></script>

I tried to add directly in the post but got no results!

I would like to know how I can unusual these scripts in posts?

  • 1

    I find it unlikely that wordpress.com will allow you to publish random scripts in the content, but I would ask here: https://br.support.wordpress.com/

  • Thank you very much!

  • @Thiagoluizdomacoski I tried to describe there in a simple way. Then tell me what you found.

1 answer

0


cannot add external scripts in Wordpress.com.

To add codes, it is recommended to use the shortcode [code].

Example:

[code language="css"]
your code here
[/code]

You can read more about this shortcode (in English).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.