Inserting same line of text of every web page - "link" insert?
Inserting same line of text of every web page - "link" insert?
(OP)
Hello
I've a copyright sentence which goes at the bottom of every web page - unfortunately there are over 5000 of these pages (all transcripts of old documents).
Is there a HTML tag which might "import" this line? They are static HTML pages, but I would like to update one file with the updated year and wording rather than doing it on all the pages manually.
I don't see anything, but I think I might not be searching correctly.
I've a copyright sentence which goes at the bottom of every web page - unfortunately there are over 5000 of these pages (all transcripts of old documents).
Is there a HTML tag which might "import" this line? They are static HTML pages, but I would like to update one file with the updated year and wording rather than doing it on all the pages manually.
I don't see anything, but I think I might not be searching correctly.
thank you for helping
____________
Pendle
RE: Inserting same line of text of every web page - "link" insert?
5000 static HTML files is quite bad idea. Even if your web server is serving static files, those should be generated based on some template(s) so you can re-generate them whenever needed.
There would be a couple of ways :
- JavaScript with or without AJAX : needs a script block or scrip file included in each HTML file, the inserted note will not be part of the page content
- iframe : needs an iframe tag in each HTML file, the inserted note will not be part of the page content
- SSI : needs a special tag in each HTML file, needs server configuration, the inserted copyright note will be part of the page content
- static generator : needs a special tag in each HTML file, the inserted copyright note will be part of the page content
Personally I would prefer to use a static generator. Of course, given the amount of files probably not a readily available one, but a custom made. If the HTML files already contain the copyright note, then would use sed or some other text processing tool to transform it into something templateish ( like "{{copyright}}" or "Copyright © {{year}} {{owner}}" ) that can be easily replaced later with the actual content. If not contains the copyright note yet, would look for a suitable spot for it ( for example right before the closing </body> tag ) and insert the mentioned templateish thing.Of course, we could suggest more suitable solution if we could see one such HTML file.
Feherke.
feherke.github.io
RE: Inserting same line of text of every web page - "link" insert?
Thank you for replying. These files I inherited when the person who used to run the website had to give up and I offered to help (!)
Here is the text of one of the files
thank you for helping
____________
Pendle
RE: Inserting same line of text of every web page - "link" insert?
Ah, so they are not static HTML. And the copyright note is already there. Then I would run a command like this :
CODE --> command line
Note that the -i option means in-place, so the files specified as parameters will be modified. Make sure you create backup copies of those 5000++ files before using that command.
Also note that if your files are organized in multiple directories, you have to take care in running the above command for each.
Feherke.
feherke.github.io
RE: Inserting same line of text of every web page - "link" insert?
https://tools.stefankueng.com/grepWin.html
No guts, no glory.
RE: Inserting same line of text of every web page - "link" insert?
thank you for helping
____________
Pendle
RE: Inserting same line of text of every web page - "link" insert?
you could use find and sed combined as a one line shell command
CODE --> shell
Chris.
Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Never mind this jesus character, stars had to die for me to live.