Closed ksdavidc closed 1 year ago
This most likely has to do with the plugin version you are using. You will need the latest plugin version before updating the template. This is because there are sometimes added new files to the template, and you'll need the latest plugin so that it knows about these.
So try updating the plugin, then do another template update. Hopefully it should work properly then. Let me know how it goes 😄
Any luck @ksdavidc? Let me know if anything was unclear or if you need any help.
thanks for checking. I have been a little busy this weekend and haven't had time to try it. I'll probably get to it next week, and will let you know how it goes. Thank you! :-)
On Sat, Dec 10, 2022 at 1:01 AM Ole Eskild Steensen < @.***> wrote:
Any luck @ksdavidc https://github.com/ksdavidc? Let me know if anything was unclear or if you need any help.
— Reply to this email directly, view it on GitHub https://github.com/oleeskild/obsidian-digital-garden/issues/119#issuecomment-1344479098, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO2Y35DEQNTY5FNPX4Y7EZLWMNJUJANCNFSM6AAAAAASXN7KSE . You are receiving this because you were mentioned.Message ID: @.***>
Alright, finally got to this. As you said, I updated the plugin and it seems to still be working. (Thanks) I attempted to update the template and the PR went through. There were some style changes to my headers, but I could put those in custom.css So far so good.
Except for one thing. I had made small modifications to the old repo. I needed to run a js file to format some of my code blocks, and I had to:
<script type="text/javascript" src="/js/scratchblocks.min.js"></script>
eleventyConfig.addPassthroughCopy("src/site/js");
<!-- provides scratchblock support
old selectors: div.blocks pre, .scratch, pre.language-scratchblock code, pre.language-scratchblock, .language-scratchblocks, div.callout-scratch pre, div.ad-scratch pre,
new selectors: div.blocks pre, pre code.language-scratchblock, div.language-ad-scratch pre
-->
<script>
scratchblocks.renderMatching('div.blocks pre, pre code.language-scratchblock, code.language-scratchblock, code.scratchblock, div.language-ad-scratch pre', {
style: 'scratch3', // Optional, defaults to 'scratch2'.
scale: 1, // Optional, defaults to 1
});
</script>
All but 2 I had to redo. You have made it easy to keep css changes with custom. I wonder if there is a better way to be able to preserve adding js, so I don't have to redo the changes every time there is a template update?
Great! Agreed. I've found myself being frustrated about the same thing. I will try to figure something out for making it easier to modify the garden, while still being able to update without it being overwiritten. I'll probably do something similar to the CSS solution, creating a folder where custom js can be added, that will automatically be added the page header. And will never be overwritten by a template update. Thanks for pointing that out.
Oh, that's great to hear! All in all I am very satisfied with the plugin and it has really helped me put together a quick and easy webpage for teaching purposes without all the upkeep usually associated with setting up a webpage. For me this has worked better than the other solutions I tried. I am looking forward to playing with the new search and navbar...
One thought just came to mind. I believe that in some cases it is better for the javascript to be loaded at the end (aka after page load), rather than the header... I don't know the rules for this, but I have run across that from time to time... e.g. https://stackoverflow.com/questions/1638670/javascript-at-bottom-top-of-web-page
Good catch! That was indeed true a few years ago. However, all modern browsers now supports the defer tag. This causes the script to be fetched asyncronously while the rest of the page continues to load and be parsed. This should be a bit faster than fetching them at the bottom of the page after all of the html had been downloaded and parsed.
well whaddya know -- learn something new every day! Them googles sure is clever. 😸
@ksdavidc Recently @uroybd have done some tremendous work to make the template more "hackable". You can read about how it works in the docs. Closing this, as the basic customization need has been met. If you are missing something specific functionality, please let me know by opening a new PR 😄
Thanks, that's great. I am definitely going to look into it! I really appreciate this plugin and appreciate your kind reply. :-)
Got it to work. Hooray!
I did have one hiccup, and I don't know if it is my brain being porous, or something else:
I originally tried puttling a file.njk (user/common/...) with something like this:
<script type="text/javascript" src="scratchblocks.min.js"></script>
(tried header, footer, and after content)...with the js file in the same directory.
This line never seemed to appear in the output HTML. Maybe it couldn't find the JS? Syntax?
Eventually I took the original js file and wrapped in script
<script>
...
</script>
and that worked after content.
Slightly inconvenient as the js file is occasionally updated (no CDN as far as I know) and it would be nice to avoid having to restructure it each time.
What is supposed to happen?
The 1st example should work with correct path.
However, we don't have a passThroughCopy settings for additional js. I'll open a PR for that.
The 1st example should work with correct path.
In my case, I had the js file in the same directory as the njk file. I assumed it would look in this directory first. Should I have put the path more explicitly? Maybe it was looking in the src root first?
The 1st example should work with correct path.
In my case, I had the js file in the same directory as the njk file. I assumed it would look in this directory first. Should I have put the path more explicitly? Maybe it was looking in the src root first?
Once this PR gets merged, you will be able to put the script in src/site/scripts
and refer it as /script/your-script-filename.js
.
Putting that to the njk file's directory won't work. Since only njk files are being processed from those places.
The 1st example should work with correct path.
In my case, I had the js file in the same directory as the njk file. I assumed it would look in this directory first. Should I have put the path more explicitly? Maybe it was looking in the src root first?
Once this PR gets merged, you will be able to put the script in
src/site/scripts
and refer it as/script/your-script-filename.js
.Putting that to the njk file's directory won't work. Since only njk files are being processed from those places.
I see. Sorry if it was a niggly question. I am not really on top of this kind of stuff, and was just guessing my way through. Your answer was very clear, so thank you.
The 1st example should work with correct path.
In my case, I had the js file in the same directory as the njk file. I assumed it would look in this directory first. Should I have put the path more explicitly? Maybe it was looking in the src root first?
Once this PR gets merged, you will be able to put the script in
src/site/scripts
and refer it as/script/your-script-filename.js
. Putting that to the njk file's directory won't work. Since only njk files are being processed from those places.I see. Sorry if it was a niggly question. I am not really on top of this kind of stuff, and was just guessing my way through. Your answer was very clear, so thank you.
No problem at all. These questions allow us to identify UX problems.
1st. Go slow when talking to me. I am sometimes out of my depth as far as some of this tech goes, 11ty I know nothing about, for example. I have a passable understanding of Github and obsidian, html, etc..
I tried the update function for the first time. I got the link to the PR on github and went to Netlify and found the deploy preview link and got the error report given in full below.
It appears that these are the relevant lines, as the first of these was marked in red:
Aside from that I don't know what it all means.
One thing I know is I am using version 2.20.0 of the plugin. I have not updated since I have it working and don't want to mess things up... I am not sure if it is safe to update the version of the plugin, and if that should be done before trying to update the template. Can I update the plugin without affecting the site? Or do I update the template first, then the plugin?
I closed the PR and deleted the branch. I want to try again, but I am not sure how to proceed, safely.