Skip to content
This repository was archived by the owner on Oct 27, 2022. It is now read-only.
This repository was archived by the owner on Oct 27, 2022. It is now read-only.

Is the script to format the URL necessary? #38

@ssgabrieldev

Description

@ssgabrieldev

First I'm sorry for the English.

  • Problem: I was trying to run the project locally but I was having trouble getting the css to load.

img1

I realized that what was generating this error was the javasscript scripts in the templates.html file:

var source = document.getElementById('icon').href.replace('markdownpedia.tk', window.location.hostname);

document.getElementById('icon').href = source;
source = document.getElementById('style').href.replace('markdownpedia.tk', window.location.hostname);
document.getElementById('style').href = source;

var tag = document.createElement('script');
var things = 'https://markdownpedia.tk/server/vital/search.js';

tag.src = things.replace('markdownpedia.tk', window.location.hostname);
document.getElementsByTagName('head')[0].appendChild(tag);

It swaps the host from markdownpedia.tk to the local host, but does not change the protocol. As it was running locally the protocol used is http, but to load the css it used https.

So analyzing the code more I realized that this script is not necessary, (or maybe it is depending on how you are hosting the site, in this case i'm sorry for opening this issue), because HTML itself is already capable of doing this replacement.

  • Solução: Perform the following steps for the equivalent cases in the project
    • 1 Remove the url formatting script
    • 2
              <!-- Replace this -->
              <link id="style" rel="stylesheet" href="https://markdownpedia.tk/server/vital/style.css" />
      
              <!-- For this -->
              <link id="style" rel="stylesheet" href="/server/vital/style.css" />

img2

OBS: If this is confirmed as a problem and not something intentional, I put myself at your disposal to make a PR fixing the problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions