Change Page title Dynamically

I am trying to change Page Title Dynamically,

But, Custom Code isn’t working in Softr Custom Code (Footer, Custom code block, etc…)

Here is the code below,

It works well in debugger(F12) Console,

but, not working in Softr Custom code only.

Thanks in advance : )

image
[Changed Page title by Debugger Console(F12)]

{Custom Code below}

var content_title = document.querySelector (“#list-back > section > div > div > div > div > div > div > div:nth-child(3) > div > div > div > div > h3”).textContent;

document.title = content_title;

[end of code]

You want to do this all along your website or for specific pages?

Hi matthieu_chateau,
i want this for ‘Each’ ‘Specific’ pages.

e.g.)
Contents | (Contents Title)
Q&A | (Q&A Title)
Case | (Case Title)
etc. . .

Just in case but did you add the script tags?
A javascript code starts with <script> and ends with </script>.

yes i did,

i removed <script> and </script> in the Question.

Original Code is below,

<script>

var content_title = document.querySelector (“#list-back > section > div > div > div > div > div > div > div:nth-child(3) > div > div > div > div > h3”).textContent;

document.title = content_title;
</script>

Try this one

<script>
window.onload = function() {
  var content_title = $('#list-back > section > div > div > div > div > div > div > div:nth-child(3) > div > div > div > div > h3').text();
  document.title = content_title;
};
</script>

Okay, I tired that one.

Now, Title does not exist anymore.

title code is now <title> </title>

and page title is URL of the page now.

picture below,

and it also works well with
Chrome Debugger(F12) Console

it shows the console and changes Page title in right way.

It works for me… so I don’t know… I’m stuck here, can you try to add the code in the footer of the page? if it’s not already done

Thanks, I already did it in the footer code.
And new thing is,
it works really well wirhout variables.

The thing is it works for me so I don’t know, or it comes from your browser or there is a conflict with another code

Okay, I’ll figure it out and share the reason why.

Was this ever figured out? I’d love to be able to do this for my database site, but I have no idea what I’m doing with it.

Also, how would one go about customising this? For example, I have a table called Members, and the member’s name is what I want the page title to be on the list details pages. A specific member example is this page, where the name (Nakazawa Yuuko) would automatically become the page title.

I’d rather not do it manually, as I have almost 290 member records alone, along with everything else in the database!

(Apologies if this is a simple fix and I’m overlooking it. I do have a SEO:Title field in the Members table, but I can’t seem to get that to work, either…)

@Zeke can you check your airtable SEO:Title fields doesn’t contain spaces or other characters ?

Here is one of our examples https://www.softr.io/templates-new/school-portal/r/D7uEQMyU333FZtZznetRbH

Whoops, it turns out I was being silly about something. Not quite sure what I did, but it’s fixed itself. Sorry for being dumb!