Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Change the Default Header

Deleted user February 13, 2019

Hi,

I want to set the header (h1) like the insert in the space-title field I have the following code.Is that possible?

Bildschirmfoto 2019-02-13 um 16.42.18.pngBildschirmfoto 2019-02-13 um 16.41.51.png

1 answer

0 votes
Zak Laughton
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 13, 2019

Hi Matthias,

From what I understand, you want to apply the same style of the page tile to all the "Heading 1" elements in the content of your page.

 

I was able to accomplish this with the script below, inserted into the "At end of the BODY" section of the Custom HTML admin page:

<script>
const pageTitle = document.querySelector('#title-text');
const pageTitleStyle = window.getComputedStyle(pageTitle);
const headings = document.querySelectorAll('.wiki-content h1');

headings.forEach(heading => {
Array.from(pageTitleStyle)
.forEach(key => heading.style.setProperty(key, pageTitleStyle.getPropertyValue(key), pageTitleStyle.getPropertyPriority(key)))
})
</script>

It essentially uses .getComputedStyle() method to determine the style of the page title, then applies these styles to each the Level 1 header in the content.

I hope this helps!

Deleted user February 13, 2019

Hi @Zak Laughton,

thanks for your quick answer, I mean when I create a new room with my space blueprint that the h1 is an input, not the name + home page as normal. If I want to create a new space with my space blueprint, there is a field header and I want this input to be set as page title, I hope I explained it better.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events