So, I’ve noticed I’m reusing the same base HTML code for every page I have, and only changing the HTML in the main container.
To stop this + make my website way easier to change throughout all the webpages, I will be using the jQuery load function to load the HTML/content into the main container.
(If you have any better suggestions on how to implement this, let me know)
I think this is a decent solution, however it is very unpleasant to have my site use ?p=test-page rather than /test-page/
Is it possible to do this? As well as for things that are in other directories e.g. /other/some-page/
I guess you’re doing it because you have too many requests
and some of your websites are suspended
basically you want to have a dynamic page
base is up and new content down
browser can execute javascript and produce content on the fly but google crawler can not (SEO problem)
the server needs to give a crawler an HTML snapshot - but I think you need to
have control over the server
as far as url is concerned
htaccess and URL Rewrite do the work
possible problems with ?i=1 (security) and your RW URL’s
@OxyDac Thanks.
My requests are fine, I just feel bad always copy and pasting the exact same HTML for every page.
This is an example of what I want:
<div id="navbar">...</div>
<div id="mainContent" class="container">
<!-- My custom HTML here -->
</div>
<div id="footer">...</div>
Alternatively, I was thinking of making myself a parser that will put the custom HTML into the template. This might make my site load faster, and make SEO not a problem, just I’ll have to reupload every HTML page every time I change the template.
Example:
<!-- USE template.html -->
<!-- HEAD -->
<script src="example.js">
<!-- MAIN -->
<h1>My main content here</h1>
...
etc
While you could put your pages together with Javascript, doing so would be anything but fast and likely wouldn’t be good for SEO.
Another method which works a lot nicer is to use PHP to include common components. That way, the includes are invisible for your visitors while still making it easy for you to combine shared components.
I have 32 pages and the easiest part of my work was C/P
Separate segments with comments
line numbers are always the same
example - your diff.content <body> starts on Line 250 (and you just have to scroll there)
you easily find the problem and modify all the pages
It’s easy for the brain - to attach all pieces of puzzle together
fonts, css, js, images are cached as soon as someone comes to the first page
only the difference is loaded when visit another page
Moreover, you will not modify it on a daily basis
once you do it; that’s it
you will not c/p 100x per day
you just need to have <head> and <footer> same
of course <title> different