Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8551265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:09:33+00:00 2026-06-11T14:09:33+00:00

I have many pages on a site im developing, in which each page has

  • 0

I have many pages on a site im developing, in which each page has its own title tag. In many cases the titles have constant text, for example:

Home | Section 1 | Page 1
Home | Section 1 | Page 2
Home | Section 1 | Page 3, etc…

Inserting these titles makes for harder changes later on, not to mention the hassle of remembering to add them. I’m looking to find a method of dynamically generating the title of each page with javascript, based off the location of the page within the folder structure of the site.

Im currently using a script that does something like this for breadcrumbs, but am not sure how to either reference the same script, or build a similar one for page titles. The breadcrumb script is here: http://trcreative.us/dev/jmsracing/js/breadcrumbs.js

and for the most part doing exactly what I need for titles, minus links per each breadcrumb item. (I don’t want it to do that for title’s obviously).

See breadcrumbs applied here: http://trcreative.us/dev/jmsracing/races/pigman-long-and-olympic/

Any help would be appreciated. Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:09:35+00:00Added an answer on June 11, 2026 at 2:09 pm

    Assuming that your url’s are as following home/section/page.html you could use this function at the top of any page and it will set the title based on the url if that’s what you mean.

    function setTitle(extra) {
      document.title = location.pathname.split('/').map(function(v) {
        return v.replace(/\.(html|php)/, '')
          .replace(/^\w/, function(a) { return a.toUpperCase(); });
      }).join(' | ') + (extra && ' | '+ extra);
    }
    

    Using this function will generate a title like this: Home | Section | Page. If you want to add specific stuff for a particular page then pass a string as the extra parameter and it will be added to the title ie.

    // url: http://mypage.com/home/about/frogs    
    setTitle('Frogs are awesome');
    console.log(document.title); //=> Home | About | Frogs | Frogs are awesome
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ok i have a project which has many gridview in its pages... now i
On my site I have a config file which has many settings that need
I have a sharepoint webpart that will exist on many pages. The webpart has
I'm currently developing a Django site in which users can have multiple 'accounts', so
I have an aspx website with many pages which accept user input, pull data
I have asp.net site. On many pages is used datetime to be putted from
I have a website that contains company profiles. These profiles have many pages within
I have many fan pages that I admin in Facebook and I made a
I have to download many many web pages and I am going to use
I have a web project in Asp.net MVC where in many pages, there is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.