Ghost CMS Custom Page assets route - handlebars.js

I'm trying to create custom page in Ghost. I named file "news.hbs" for listing all the news items. Also I use webpack. Why while creating new custom page in template all the routes are matching as "news/*"? For example, while webpack generates "news.hbs" file, Ghost requires not an original path "img/header-bg.png", but an "news/img/header-bg.png". How to handle that? In main file "index.hbs" all the paths are valid, without extra folder's names.

You should modify the routes.yaml file for the routes to start working. Look at this documentation for more info: https://ghost.org/docs/api/v3/handlebars-themes/routing/

Related

Next.js dynamic route template

I want to create a dynamic route structure for my next.js project, so the main directory would be countries and there will be many other countries under that directory.
www.mysite.com/countries
www.mysite.com/countries/united-states
www.mysite.com/countries/france
www.mysite.com/countries/united-kingdom
....
In my pages folder, I create a folder called countries and created a file [...slug].js. I have to create a file index.js inside the countries folder for www.mysite.com/countries to be accessible.
The issue is that index.js and [...slug].js have the same code, and I want to have only 1 file to maintain. How can I configure nextjs to use [...slug].js for www.mysite.com/countries and any sub pages under it?
You can simply change [...slug].js to [[...slug]].js to catch all routes starting with countries. It is treated as optional URL parameters in NextJs.
Official NextJs documentation also said that:
Catch all routes can be made optional by including the parameter in double brackets

Admin page webmatrix i already have a *.cshtml file in root folder?

I am unable to see _admin page in Web Matrix. i already contain a *.cshtml file in root. Also my nuget package manager keeps on uninstalling itself please help me i am new with all this.
If you name a file with an underscore like _admin.cshtml, you will not be able to access it directly. You will however be able to navigate to it if you name it admin.cshtml.
Usually you will want to use underscores on the name when working with things like RenderPage or Layout pages: _Layout.cshtml.
This article has some helpful information on using Layout pages:
http://msdn.microsoft.com/en-us/magazine/gg983489.aspx

How to make CQ5 use .htm extensions instead of .html?

I am converting a huge site from MS CMS 2002 to Adobe CQ5. In the existing CMS all pages are referenced with .htm extension. When I create a new page in CQ5 it always has .html extension. Is there any way to force CQ5 to use .htm extension for pages?
A list of default extensions rendering the content can be modified in the configuration of an OSGi service called SlingServletResolver. In order to change it, open the following path:
/system/console/configMgr/org.apache.sling.servlets.resolver.SlingServletResolver
on your CQ installation and add htm to the last option (Default Extensions). You may also use sling:OsgiConfig nodes to have the service configured automatically.
In addition to the other answers a different approach is to create an internal redirect from your htm to the new html pages. You can create a Sling mapping under /etc/map which will redirect htm requests to html.
Information on configuring the sling mapping can be found here http://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html under Root Level Mappings -> Mapping Entry Specification
Tomek has provided the best solution for this problem. However, this solution will change the extension type for all the pages. If you want another solution to target specific pages then here is the solution:
Override the head.jsp for /libs/foundation/components/page by copying this file to apps folder and there specify the content-type and content="text/htm.
Now you have to refer to this component as a superResoucetype for every component or template wherever you want a htm or any other extension extension.

How to point at the templates folder of a module in Drupal 7

How do you make Drupal read the templates you create or override in a module (when you create templates that get overriden in the theme folder, Drupal reads them automatically)?
When you implement hook_theme() or hook_theme_registry_alter() (in the case you are overriding a template file defined from another module), you use the "path" property to tell Drupal where the template file is.
This is particularly important with hook_theme_registry_alter(), since you are overriding the template file used by another module, and you want Drupal looks for the template file in your module's directory. With hook_theme(), it is important to use the "path" property when the template file is not in the directory containing the module (or the theme), but in another directory, for example in a sub-directory of the directory containing the module/theme.

Drupal6: I need to customize file upload links in node edit form

I am customizing the node/add and node/edit forms of a content type with a form_alter. In my content type, there is a file field that permits to upload files to the content.
What I would like to do is to customize the file box by changing the link to the file that is composed at runtime with Ajax. How can I do it without modifying Drupal core?
Your Private Files directory should not be in the docroot. Hiding it with a .htaccess rule will not work, as you point out in a comment.
Say you have Drupal in /var/www/sites/example.com/, then you should not store your private files under that directory; /var/www/sites/example.com/sites/default/private/files/ is just plain wrong.
You should, instead store the files where apache will not serve them, but can read them. E.g. in /var/www/files/example.com/. Then change the setting in Drupal to use that absolute path.
If you are running a large(r) site, you will probably want to store your files on a dedicated mount (drive, NFS etc.), say /media/nfs-example-com/.
Try Filefield Paths:
The FileField Paths module extends the default functionality of Drupals core Upload module, the FileField module and many other File Upload modules by adding the ability to use node tokens in destination paths and filenames.
http://drupal.org/project/filefield_paths

Resources