Organizing blogdown/Hugo structure properly for automatic update of content - r

A detailed question about organizing content for blogdown/Hugo properly.
Built two websites with blogdown/Hugo, deployed via Netlify. One is simple and is easy to update, the second starts to become a mess because of my failure to organize content properly.
Basically, as I understand, we have two main folders /content and /public.
I am developing everything in /content.
The current structure of /content looks like this.
Any folder in /content like /content/team or /content/post has the same structure:
rmd files
html files
/img folder, where I store images
Example:
The problem starts at /public folder, it became a mess.
In my more simple web-site everything updates automatically as soon as I save my work and do blogdown::serve_site(). Here it is not.
For example, the same /team folder became a mess and looks like this.
Here I have .html index file, some other folders, which I did not create. I created public/team/images though, trying to understand where to locate the file.
The main problem that in this folder /public/team there is another folder /public/team/team (not sure why), where my index file is updated, when I update the code. As a result, instead of automatic update of the whole web-site content, I am forced to move .html index file from /public/team/team to /public/team manually, which sucks. Basically it forces me to have a separate index .html index file for each web-site tab, otherwise, the website has different views, when I switch tabs.
I obviously googled how to fixed this, but I found these Hugo content guideline tips not very intuitive for my level of expertise of working with blogdown/Hugo.
Thanks!

Related

.cshtml File Not Refreshing

I have a file named _RelatedProductsPartial.cshtml located in an MVC project in the Views/Shared folder that is used as a partial view inside a products page to render a carousel of potentially related products. The related products show up as expected, but the URLs are incorrect. I made a backup of the file and tried editing the file to fix how the URLs are being dynamically generated and saved the file and tried again, but my changes were not reflected as the URLs are still in the original format. I even tried just editing some text and retesting and that change was not reflected either. My question is, do parital/Shared views actually need to be compiled into the relevant DLL? Is that why I am not seeing the changes reflected? I am new to Asp.net so I hope there is a simple solution to this issue. Thanks.

use gulp to rebase CSS urls

I have a question about how to solve the following situation:
In my sass-files I use absolute path variables in my main include files, e.g. fonts are located in /assets/fonts/... and icons are located in /assets/icons/... and so on. Now these paths are obviously working only when the domain is in root.
The environment I wish my application to run on has a different folder structure which goes a few levels deep.
Here is an example of the file structure in my development environment:
/root
assets
icons
...
home
home.scss
page1
module
module.scss
Here is an example of the file structure in the new environment:
/root
various
subfolders
assets
icons
...
css
home
home.css
page1
module
module.css
As can be seen: The compiled CSS gets created in subfolders which can become quite deep, i.e. like 8 stories deep. The root declaration in my css will no longer work because of the new tree structure.
My options are as follows:
adjust my sass so that at all paths are relative (don't like to do that, will make my sass more complicated, everything seems to be good the way it is)
adjust my .htaccess so that this is covered (don't like that either, have to adjust everytime I switch the environment, seems "hacky")
create/use a gulp task that fixes my compiled css files so that the relative paths are added to all findings of url("/assets
I have searched quite a lot, looked into thread2, gulp-tap and gulp-replace. But somehow I can't quite get it right. For instance: The obvious solution, gulp-replace, is not working as I need it to because I need to get information about the file that is currently in the pipe (to get its file.path and thus find out how many stories the file has climb up to reach the assets folder).
Does anyone has ever done this? Or maybe has an idea how to solve this?
Alright, solved it myself. I have created a gulp-plugin for this:
https://www.npmjs.com/package/gulp-css-adjust-url-path

Directory structure of an ASP based app/CMS

I am doing a small audit of a fairly robust ASP app and CMS for a client (does a good bit more than a regular CMS) and started looking into the code. (edit: This is for a quick overview prior to engaging a full fledge ASP shop.)
I am coming from a background mainly in PHP, Node.js, and Ruby but when I look at the layout of the directories and files it looks horrible. It reminds me of old PHP 4 apps with files all over the place.
My question is, is this still good coding practice in ASP? I expected to find a much cleaner/easier to understand structure with a more custom app like this. Much like the Rails/Zend/etc of the other languages. Here is a screenshot of a few of the files from the webroot.
A side question would be, are there better ways to organize files in ASP? I have not coded with ASP in 6-8 years, and it was still not very much I used it for.
This isn't ASP, it's ASP.NET; I also note it's WebForms, not MVC, which has very different layout.
Anyway, the directory structure is a mess, it's horrible. Here's what's wrong with it:
Unholy mishmash between static HTML files and ASP.NET webforms files
Code files (e.g. contact.aspx.cs) are present on the server when the application looks to be compiled (because it has a bin directory), so they shouldn't be there at all.
There is no consistency in folder and filename casing. Some are all lowercase, others are TitleCase.
You appear to have duplicate folders, what is the difference between "Images" and "img"?
What on earth is "missing" and "layouts" for?
Duplicate, disorganised files index.html, index1.html, etc.
Then there are a few other concerns, but those are down to developer preference:
Generally, projects only have one or two MasterPage files, so it doesn't make sense for them to be outside of the root folder. I put my *.master files directly in the root of the application.
Images related to a stylesheet should be placed in the same directory as the stylesheet rather than in a sibling folder (I'm assuming the images referenced by the stylesheet in the "css" folder are actually located in "img"). This is bad because it complicates the CSS file (as it has relative paths inside it) and makes your application more brittle.
Fonts seems to contain font files, again, referenced by your stylesheets. They should all go under a single "styles" folder.
Any image "content" (i.e. <img src="" /> elements), not images used in stylesheets, should be kept separate from stylesheet images, I'm assuming this why you have the confusing "img" vs "Images" folders.
As for the correct way to do it, ASP.NET WebForms does not lead itself to tidy, well-organised applications. Because each (non-rewritten) URI corresponds directly to an *.aspx file it means the filesystem layout has to match the website layout. I'm afraid there isn't much you can do about it unless you implement ASP.NET Routing.
I also suggest eliminating all of your HTML files and converting them into ASPX files that make full use of UserControls and MasterPages as appropriate.

Rails: Stylesheet/view issue? Nothing is showing on the screen although there is source code when viewed in browser

I have a rails app with many partials for one view, each partial is a section in the view (one paged website).
I have put all my assets in the correct places etc.
below is a screenshot of how the actual page should look (outside of rails) (header, then section one which you can see, and there are sections below etc).
However this is how it is showing when done in rails
No images are shown for some reason, nor any content.
When I do not include the style sheet, all the content (writing) shows fine. When I include the stylesheet, everything disappears, its all white. However there are content there because I am able to scroll up/down.
Below is a screenshot of the structure of my files
I basically have all my images inside the image folder, but there are subfolders inside the image folders.
so:
assets (folder)
images (folder)
section_1 (folder)
image.png (file)
in my css, because my css files are inside the stylesheets folder, I call my urls as follows:
background-image:url("../images/section_1/image.png");
As for my views, it is basically one view which renders out each section (partial).
Try background-image:url("section_1/image.png");
This works in my rails project. However, I'm using compass, so it might be different.
I know what the problem is. But I still have one more problem.
The solution.
When calling an image from anywhere, even if you have a sub directory like I have, you simply call the url as follows:
background-image:url("assets/header/header_bg.png")
So you basically leave out the images folder for some reason.
The problem I still have is a routing issue.
In my assets folder I have a folder named fonts.
Inside this folder I have a number of folders, with different fonts in each folder (.eof,.ttf.svg) the usual font files.
When I type in the exact url of where these files are stored I get a routing error.
I also have a file called fonts.css in my stylesheet folder.
In the url if i put localhost:3000/assets/fonts which is the folder of the fonts I get a routing error.
Is there anyway in the routes file can I route the application correctly?
Both for the images and for the fonts?

customising sharepoint site design

My work has recently deployed Sharepoint and I'm currently trying to get to grips with it.
I'd like to be able to completely customise the way my blog looks but I have no idea where to start. I had a look through Microsoft's developer site and it does look like they have a lot of stuff there but it all seems to be pitched at a much higher level than I'm at.
I'd consider myself pretty experienced with CSS and web development, does any of this translate into sharepoint? Can I make a new CSS file and upload a bunch of images into a store and change the look of my 'site' that way, or is it a lot more complicated?
I realise this is a little vague, but I'd really appreciate some pointers to a "getting started with making sharepoint not look sucky" guide or an example of the sort of thing I can actually hope to achieve. Hopefully my question isn't too high-level.
Thanks
Use SharePoint Themes, their installation is tricky at first but once you get a good development environment you'll be able to test modifications in the traditional "save css file, press F5".
Themes have these pros:
Do not need sharepoint designer
Do not need to change masterpages and deal with (un)ghosting (the sum of all fears)
Can be applied to one subsite and have other subsites with different themes (see gl-applytheme in google for mass application of themes thru many subsites)
and these cons:
You have no access to HTML changes, for that you need masterpage love (I dont think thats a con, its a limitation that usually exists in different scenarios and also makes you improve your css skills so much in the css-zen-garden way)
Themes once applied, go to the server memory -- meaning that if you change your theme folder you need to recycle the application pool, apply a different theme and apply your theme back to see that one pixel border you forgot to put in the footer. But for that specific problem I have a solution below:
After you do your "theme setup" you'll be able to only work with CSS and images and be free to overwrite any class in SharePoint using your favorite Developer Toolbar/Firebug addon to find what you want to change.
In the folder c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES create a folder named THEMEDEV
Inside the new folder, create a file called theme.css and another called THEMEDEV.INF
Inside the .INF file, paste this:
[info]
title=THEMEDEV
codepage=65001
version=3.00
format=3.00
readonly=true
refcount=0
[titles]
1033=THEMEDEV
now open the c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033 folder (1033 is your language code, thats the default for english installations)
edit the SPTHEMES.XML file
below <SPThemes ...> insert:
<Templates>
<TemplateID>THEMEDEV</TemplateID>
<DisplayName>Development Theme</DisplayName>
<Description>Development Theme.</Description>
<Thumbnail>images/thnone.gif</Thumbnail>
<Preview>images/thnone.gif</Preview>
</Templates>
now edit your theme.css file, add an import to your favorite CSS development folder:
#import url('file:///C:/SharepointThemes/Theme1/theme.css');
Save everything, open your sharepoint: Site Actions => Site Settings => Look and Feel => Site theme => choose your Development Theme and hit Apply
If everything worked, you can now edit your C:\SharepointThemes\Theme1\theme.css in your favorite editor, save it with something like
* { color: red !important }
and see the changes on your site.
Something also important when developing themes: do not create folders to store, say, your images, use everything in the same folder and in the code itself use a relative fashion, like background: url('image.png')
ps1: Only you can see changes you are making to your sharepoint site due to the file://c:/ folder, if you need more people to see the changes during development, setup a network path that they all have access, the rest is the same.
ps2: Keep in mind this is a development environment, to make your theme a live theme you need to create another one to store all the content used to change your site's visuals.
The process is similar to the one creating the THEMEDEV one, just put a pretty and consistent name across all configurations (Folder name, .INF name, .INF contents, SPThemes.xml node contents), paste all your images in the Theme's folder and replace the theme.css file with your content.
Edit1: Reading your comment above, now you have a "editing + uploading to FTP" type of setup :) this works for MOSS and WSS by the way (even if you don't know the difference). For more info on customizing sharepoint, I made a post yesterday about more options:
Sharepoint: How to remove default core.css reference?
I like to always use this post as a starting point for SP branding: http://erikswenson.blogspot.com/2008/10/functional-sharepoint-branding-style.html
It depends on whether you're talking about a WSS 3.0 site or a MOSS site. WSS 3.0 sites can be customized using themes. Customizing MOSS sites is a little trickier, although you can add a SINGLE custom CSS style sheet via Central Admin - in this case, your custom files, images, etc., would be deployed as a Feature.
The best explanation of how this works that I have come across is the six part series on the cleverworkarounds.com site.

Resources