Hi,
I would like to serve all assets like fonts, css and js from my local webserver instead of from google and jquery.com
as recently in my country a court decided that it is not allowed to get resources from US servers without prior permission from the users (by requesting a file from an US server the IP-address of the user is transmitted to the USA).
How can I do it to replace the requests to point to my local site?
I’m using the docsy theme.
Greetings
Docsy is a bit of a complex theme so if you run into trouble I suggest that you ask the maintainers on the theme’s GitHub repository.
With that said the general idea would be to store all external assets under the /static/
directory and then directly under the root of your project create a /layouts/
folder and copy the templates that reference those assets (while replicating their directory tree) from the Docsy theme folder.
Then in the copied templates replace the instances of the external assets with references to the files located under /static/
. The static folder resides under the root of the project, therefore an asset under /static/some.js
/ needs to be referenced in the template as /some.js/
(you can also place assets in folders for example a font under /static/fonts/some-font.ttf
would need to be referenced like /fonts/some-font.ttf
etc).
You need to copy the templates and their directory structure in the /layouts/
folder under the root of your project to override the theme’s templates without modifying its source, so that you can update it in the future.
Good luck!
if there is no font preference you can also use local font of your user to get rid of any font files like this
@font-face {
font-family: system;
font-style: normal;
font-weight: 400;
src: local(".SFNSText-Light"), local(".HelveticaNeueDeskInterface-Light"), local(".LucidaGrandeUI"),
local("Ubuntu Light");
}
Regarding Google Fonts, you can use tools such as google webfonts helper to download the fonts. These usually also offer the entry for the CSS file.
In my case, I have saved the font files in the subdirectory static/fonts/ in the theme directory (https://github.com/Fryboyter/Hugo/tree/main/themes/GythaOgg/static/fonts/titillium).
Thanks for your replies.
I managed to disable google-fonts by adding the following line to assets\scss_variables_project.css
$td-enable-google-fonts: false;