ocpure Posted May 26, 2021 Share Posted May 26, 2021 Hi anyone, I was looking for a possibility to link to a .html file wich defines everythin what I want to put into the <head> tags. Just like linking to a stylesheet. Just to avoid adaptation in each file, when something changes in the head. If I could link to a file that describes the "head" I would only need to chang it in one file. Basically the same idea as for stylesheets actually. Does anybody have a good practice here? Link to comment Share on other sites More sharing options...
Ingolme Posted May 27, 2021 Share Posted May 27, 2021 It's generally done with a server-side programming language. For personal sites, PHP works fine for that. In PHP, you would use the include() statement. Link to comment Share on other sites More sharing options...
dsonesuk Posted May 27, 2021 Share Posted May 27, 2021 I generally use one for head to hold css links, meta tags charset etc and another for js links and coding at bottom. Link to comment Share on other sites More sharing options...
ocpure Posted May 27, 2021 Author Share Posted May 27, 2021 first of all thanks for helping me out @Ingolme okay, sorry if I sound weird it is all relatively new to me: that means I would link to a php file in the head-data and that php file would link to all css and js etc files with the include() funktion, right? @dsonesukI think didn't get that right? Is it like; you link to one css file in wich you define all the stuff or in wich you again link to a variety of other css files and then the same for js at the bottom of the html page? Because my problem is; I don't want to put everything into one css, that doesn't make to much sense to me. So I have for every issue a different css file, what makes it pretty complicated to put all the links into the head-data of each page, or what ever files are needed on that particular page. I just want to put one link for each (css, js etc.) and on the other side than list all my files just once, so that the particular page loads always everythin necessary for that page. Like when I refere to a class or something the reference to every css file is always given. I'm not sure whether I am able to explain myself correctly (not a native speaker) Link to comment Share on other sites More sharing options...
dsonesuk Posted May 27, 2021 Share Posted May 27, 2021 Everything that is duplicated into every page you add to, for example 'head-tag-include.php' which would be css files, meta tags such as charset and viewport. Other meta tags, css files that are specific to that page can be added under the 'include' or 'require_once' function calls to 'head-tag-include.php', css files need to load first, cause they load usually lighter and therefore quicker to show your design as the page is read from top to bottom. That is why javascript is included at the bottom of page, it can take longer, but more importantly, any html elements js refers to through id or class, needs to exist before javascript does any processing. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now