Links between pages in quarto website with qmd files in different subfolders - hyperlink

I am creating a website with quarto (using RStudio). I want to have links between pages on my site, which usually works as described here in the quarto documentation. However, I have saved the .qmd files for my pages within separate subfolders within the project directory as shown in this example _quarto.yml:
website:
title: "Main Title"
navbar:
title: "Navbar Title"
left:
- text: Pages
menu:
- text: Page A
href: folderA/pageA.qmd
- text: Page B
href: folderB/pageB.qmd
When trying to add [link](folderB/pageB.qmd) anywhere within the pageA.qmd document, it incorrectly creates the link as folderA/folderB/pageB.qmd which obviously does not work.
How do I correctly assign links between pages in this setting?

It's a bit tedious but you should be able to use relative paths, i.e. .. to move to previous directory.
So in your case that would be [Link](../folderB/pageB.qmd). Not a great solution but as long as your directory structure stays the same, it should work.
If you later on find yourself changing the structure you can use aliases to keep the old links alive.

Related

IPB4 Where custom pages are stored?

Title pretty much tells everything. I'm unable to find where my created "custom page" is stored in Invision Power Board 4. Made it via its acp. Thanks for helping me out with this.
In IPB4 they are stored in the database, in separate tables for blocks and pages.
cms_pages - custom pages
cms_blocks - custom blocks
If you're intrested in modyfing them, refer to block_content and page_content columns. Remember to not include <?php ?> tags for your custom php blocks.
If you're looking to edit your custom html page in your favorite editor and don't copy paste the code in ACP at every update I may suggest a solution.
Create a new directory in FTP in your forum root, for example :
/custom/some_feature/
Create your target file inside :
/custom/some_feature/page.html
Paste this in to your custom page in ACP :
<script>
jQuery(document).ready(function() {
jQuery("#main-container").load( "/custom/some_feature/page.html");
});
</script>
<div id="main-container" style="min-height: 300px;"><div>
That's it, now you can edit your file in the FTP and it will be up to date on the forum.
You can go even further and setup a tool to synchronize your local files with the ftp automatically. If you are on Windows take a look at WinSCP.
For macOS and Linux there should be plenty of solutions as well.
Hope it helps, good luck!

How to create a custom page in ActiveAdmin gem

Ruby 2.0, Rails 4.0, PSQL 9.3
In the ActiveAdmin documentation there is the example:
ActiveAdmin.register_page "My Page" do
content do
para "Hello World"
end
end
Where do I put this code? The documentation says:
In the above example, a new page will be created at /admin/my_page
with the title “My Page” and the content of “Hello World”.
This implies that such a file would be created automatically somehow? Nevertheless, I created a file named import.rb under app/admin and the Import item in the menu does appear. However, I am not able to use HTML, as this file is .rb and not .erb. I suppose, in order to be able to use html, I need to create a partial and den render it within the content method. But when I look under app/views there is not admin folder (only layouts). Does this mean I need to create the folder admin under app/views? If yes, where should I put my partial - directly under app/views/admin or under a new folder app/views/admin/import?
I am sorry for the menu questions, but the documentation of ActiveAdmin is pretty modest. I would really appreciate if someone could provide a more details explanation of the steps needed for creating and adding content to a new page in ActiveAdmin.
What the documentation meant was that if you create a new custom page app/admin/my_page.rb, this page will be available in the URL /admin/my_page (if you are using the default ActiveAdmin configuration).
Regarding rendering of an ERB or HAML partials for your my_page.rb, you can do it this way:
ActiveAdmin.register_page "My Page" do
content do
render :partial => 'about'
end
end
This will look under the directory app/views/admin/my_page/. If the directories do not exist, create them. Also, you can still specify other directories by referencing the full template path (e.g. shared/sections/about) like you would for a non-ActiveAdmin controller.

Grouping umbraco pages in folders without affecting URL

One of our Umbraco sites is getting a bit messy and I was wondering if there was a way of grouping pages in folders without affecting the URL. So for example if under the homepage I have some top level sections, some footer links and various other system pages. I'd like to group the footer pages in a footer folder, the system pages in a system folder but I don't want all the URLs to become /footer/page1, system/contact etc.
Is there a nice way of doing this, maybe something with umbracoUrlName?
There are two answers, first you could turn on the 'hide root folder' option in web.config - then you can have as many folders in the root as you like - without them forming part of the url.
umbracoHideTopLevelNodeFromPath Causes the top level content items to
be excluded from any url paths. For example, this is pre-set to True,
so:
[Content]Home = /home.aspx or /home/
[Content]Home\Projects = /projects.aspx or /projects/
[Content]Footer\Page1 = /page1.aspx or /page1/
[Content]Home\Projects\About = /projects/about.aspx or /projects/about/
http://our.umbraco.org/wiki/reference/webconfig
Secondly there are four 'hidden' redirect fields on every umbraco node (which you can add into the document type) which can change the url routing:
umbracoRedirect (content picker) - Umbraco will redirect to the picked page
umbracoInternalRedirectId (content picker) - Umbraco will load the picked page without changing the url
umbracoUrlName (textstring) - Umbraco will override the page’s default url
umbracoUrlAlias (textstring) - You can have several urls for the same page (not sure when this is useful)
So I guess in your scenario umbracoUrlName will pick out a page in your combined folder but with a url that you choose.
So you have
homepage
|- footer
|-page1 (umbracoUrl = "/footer-page1/")
and /footer-page1/ would render your page stored in the footer folder.
You could also hack things about and make umbracoRedirect & umbracoInternalRedirectId work but I'm not sure that it would help.

Links to Document are empty after publishing

Can anyone help with the following issue please?
(Umbraco version 4.0.2.1)
After publishing the new site and its sub pages, the links to document are blank and the Alternative links are just "N/A" for every page pusblished including root. When I opened www.123.com in my browser, it would just show the old content from the old site instead of the new content from the new site.
(www.123.com is a dummy url)
The Content tree is as follows:
Content
-- New site (published and assigned to www.123.com)
-- New sub folder #1
-- New sub pages
-- New sub folder #2
-- New sub pages
-- Old site (unpublished and unassigned from www.123.com)
-- Old sub pages
Is "old site" visually listed before "new site" in the content pane? You may want to reorder if so.
You could also try rebuilding the Umbraco cache. Visit:
YOURDOMAIN/Umbraco/dialogs/republish.aspx?xml=true and click republish
(see http://our.umbraco.org/wiki/reference/api-cheatsheet/publishing-and-republishing for more info)

Adding content to static files(pages)

I have several static files(pages), which are basically copies of my website pages source code, with the content changed.
These files support my website, (keeping the same format) in various ways.
For example the menu part is:-
<body>
<div id="menu">
<ul class="level1" id="root">
etc
etc. until
</ul>
</div>
Unfortunately every month or so my menu bar changes and I have to update each static file manually.
As each of my static files have the same menu.
Is it possible to have one menu file which can be updated and have the static files load them automatically.
I plan to have several more static files. So this would be a great help if someone can suggest how to accomplish this.
Oh yes. Use some javascript magic to load the menu bar upon page load and keep it in menu.html.
One solution may be to use a spider (wget --recursive) to download generated pages directly from your application. One command, and you have the full copy of your site. (just add some useful options, like --convert-links, for example).
The other option may be to write an after_filter in your controller, and write the generated content to a file (not always, but for example when you add a parameter ?refresh_copy=1). Maybe just turning on page caching would be suitable? But the problem will be that you will not be able to trigger the controller action so easily.
If you don't want the whole site copied, just add some specific routes or controllers (/mirrorable/...) and run the spider on them, or just access them manually (to trigger saving the content in the files).
I ended up creating one controller without a model.
rails g controller staticpages
I then created a layout file which imported the individual changes to the layout, via a "yield" tied to a "content_for" in the view files(static files(pages) in the "view of staticpages" (for example abbreviations, aboutthissite etc etc).
The rest of the static file loaded with the usual "yield" in the layout. Works a treat. No more updating the menu bar all done automatically.
To get to the correct static file I created a route using:-
match 'static/:static_page_name'=> 'staticpages#show' (or in rails 2.x:-
map.connect 'static/:static_page_name', :controller=> "staticpages", :action=> "show"
"static_page_name" variable accepted anything after "/static/" in the url and passed it to the controller "staticpages" in which I set up a show action containing:-
def show
#static_page_name = params[:static_page_name]
allowed_pages = %w(abbreviations aboutthissite etc, etc,)
if allowed_pages.include?(#static_page_name)
render #static_page_name
else
redirect_to '/' #redirects to homepage if link does not exists
end
end
I then only had to change the links in the website. (e.g.<%= link_to " About This Site ", '/static/aboutthissite' %>)
and viola! its all working.

Resources