How to Add Social Sharing Buttons on a static site? - html

I'm looking to Add social sharing buttons on a static which is having more than 500 Static Pages.
I can add manually but it's very tedious task so looking for an easy way to add.
Is there any Way to get the Permalinks of a Static Site Dynamically I'm thinking to pass it to the Sharing Code so that I can append the URL in the code if there is any way to add a piece of code automatically to all the pages it would be of great help.
Best Regards,
Arpit

You manually have created 500 pages or using php to generate dynamically?
If it is generated dynamically, you can easily add social share plugin to every page.
HTML code for social share by social9.com
https://www.social9.com/get-free-social-share/
...Select "code your own" from the list for HTML Code.

Yes, there is a way.
Use regular expressions in an IDE to find the right places and place the code in the replacing string.
If that's not enough powerful, then write a script, using e.g. Bash in Linux, or Groovy, or I would personally write a simple Java program leveraging the JSoup library.
Lastly, and I would recommend that most, give up maintaining the files manually, and switch to static site generating software, like JBake.
JBake can take your HTML pages and take their content as an input and re-generate the website through templates.

Related

Reuse html in different pages

This is my website, https://unrealcousinzzz.com/.
I made it in HTML, CSS, and JavaScript. I cannot use PHP or anything like that right now because I am hosting it in AWS S3, because lightsail is too expensive for me. On each page in my website, I use the same HTML code. For example, every page has code for my navbar, and code google AdSense.
If I want to change these, I would have to do it on every page right now. Is there a way to make a file that other HTML pages will read, and use that where it is placed in that page?
HTML itself doesn't have any sort of templating, but there are alternatives.
Use something on your dev machine to compile your HTML for you. I use a Node.js script and a JavaScript template engine for this. Basically, I write out my templates, run the script which generates the HTML, and then I upload it to the S3 bucket.
It doesn't have to be done with Node. You could use PHP with this same method. Or, a Bash script for that matter.
Ok, so for me google tag manager is good. I can add custom html, and it goes onto all of my pages.

Is there anyway to add the custom HTML/Script in the head tag on static pages via any application?

I want to add my custom script tag / html code in the head tag to all the static pages. I can manually add my script to the static pages, but i have more than 10,000+ static web pages, so if I were to start editing my code it will be so much time consuming. I want to know is there application out there which can help me to achieve this result. I tried cloudflare which is best for custom apps but I didn't find any app which will allow me to add custom script to my head tag. Anyway to add script automatically?
Is there any application out there or app that will be automatically add my script to the head tags on my live website pages? I prefer adding on live website.
Thanks
You can use:
Find in Files function of Notepad++
Find and Replace function of Adobe Dreamweaver
Both of this functions has a find in documents function, where in you could search and replace from multiple folders at once. But take note that you must provide the unique part to replace, for example:
FIND:
</head>
REPLACE:
<!-- YOUR SCRIPT HERE -->
</head>
And lastly don't forget to backup first, just a friendly reminder :D
Most IDEs have a find/replace feature that works on a file basis. You could load your entire repository in Visual Studio Code, for example, and it would do it. It also has a filename filter to help. It would take a few minutes, but it would get the job done.
Also, I'm really curious how you ended up with 10,000+ static files without something generating them that you could modify.

Isn't the html of the form Django displays on the screen?

Django shows you forms when you do basic coding, right?
Where is the html of the automatically generated form in windows?
So instead of looking for a template folder, once the developer writes the url or views code, he finds the location of the skeleton-only html that Django shows.
In my opinion, it looks like it's built somewhere like an "anaconda/envs" contains a separate virtual environment, but I can't find it.
it's maybe path?
It's well documented:
https://docs.djangoproject.com/en/2.2/ref/forms/renderers/
It loads templates first from the built-in form templates directory in
django/forms/templates
unless you have 3rd party libraries included that override these templates.
However, a quick check in https://github.com/django/django/tree/master/django/forms/templates/django/forms/ shows that this directory is empty.
tl;dr
Django does not render any forms from scratch (unless it's the Admin which of course creates its whole UI automatically). It just enables you to quickly create a template that can render your form but you will still have to provide a basic template (aka HTML markup with dynamic parts) yourself.

How can I serve an existing html file through a View in asp.net core mvc?

I've a set of pre-generated html documentation files (provided via an external mechanism). These are fully standalone in their own right, but I'd like to integrate these files into an existing portal.
Ideally, I'd like the existing site to take care of the (common) layout, and simply embed the existing html into this layout. I've been trying to get it to work over the last few hours to no avail.
Problems I've encountered (no specific order):
The pre-generated content already contains html/body/etc. tags (as mentioned, it is standalone documentation in its own right).
Redirection is no use, as it bypasses the view mechanism, losing the common layout.
I'm not really sure how to proceed, as I seem to have exhausted my googling ability on this matter. I'd appreciate any tips or pointers on concepts or terminology surrounding what I'm trying to do - I'm happy to do the leg work investigation as required.
have you tried putting your html files in the wwwroot folder and in the Startup.cs Configure method, add the line app.UseStaticFiles();
If you really need to static *.html use
var htmlString = System.IO.File.ReadAllLines(#"patch/to/your.html");
And then pass it to view and render by #Html.Raw() but i not reccomend this way. Better create partial view and then simply use by #Html.Partial() (official docs)

KeystoneJS CMS and HTML files

I am new in KeystoneJS CMS and I am wondering if there is any way to write contact page or any other pages in html. For example if on Contact page I want to add like my address post code and stuffs and maybe a map with location or new fields for contact. Where shall I write all this stuffs. Are so many files and I don't know where to start.
Thanks
While there are a number of ways you can accomplish your goal, I suggest you try using an HTML-like template engine. Handlebars is one that is commonly used with KeystoneJS.
Here's a working example in the wild:
https://github.com/mgan59/keystone-handlebars-demo/