Learn how to reference URL relative to present web page in a block

I’ve a customized block the place I have to reference a URL relative to Drupal Development present web page (reminiscent of node/7/photographs or node/293/photographs) that can hyperlink to Drupal Development “Photos” view mode I made for Drupal Development node. I’m utilizing a module so {that a} view mode is accessible through URL (which I’ve as node/#/photographs), however I’m having bother getting a working hyperlink to /photographs that might work on any given node.

I’ve tried to hyperlink it to /photographs and /#/photographs however have gotten a 404 every time, seemingly as a result of it’s going to instance.com/photographs or instance.com/#/photographs. I’ve additionally tried utilizing Drupal Development Token for present web page URL which 404’d as effectively.

Is there a approach, hopefully via Drupal Development UI, through which I can reference Drupal Development present node in a approach that on any given node Drupal Development hyperlink to Drupal Development “Photos” view mode will hyperlink to /node/[current node #]/photographs?

I’ve seen methods to implement it utilizing customized modules or code, however I’m not very skilled with placing customized code into Drupal and like to make use of Drupal Development UI is feasible.

replace

I briefly had a repair, however then I broke it. I had obtained it working including a hyperlink that referenced “photographs/” (with out Drupal Development quotations). Whereas viewing Drupal Development node, Drupal Development customized block initially linked to instance.com/node/#/photographs as meant.

Nevertheless, I then configured Drupal Development block to be hidden on */photographs (wasn’t essential to hyperlink to Drupal Development view whereas viewing it). After I did this, Drupal Development hyperlink broke on Drupal Development node web page, as an alternative now referencing to instance.com/node/photographs, lacking Drupal Development node # in Drupal Development URL. I don’t know how this obtained damaged as I solely labored via Drupal Development UI

I attempted deleting Drupal Development block then including it once more with no impact

Utilizing “#/photographs” will direct to /node/123#/photographs (including Drupal Development precise # into Drupal Development URL) – whereas this will get Drupal Development present node id into Drupal Development URL it doesnt work with Drupal Development presence of Drupal Development # image

This article was republished from its original source.
Call Us: 1(800)730-2416

Pixeldust is a 20-year-old web development agency specializing in Drupal and WordPress and working with clients all over the country. With our best in class capabilities, we work with small businesses and fortune 500 companies alike. Give us a call at 1(800)730-2416 and let’s talk about your project.

FREE Drupal SEO Audit

Test your site below to see which issues need to be fixed. We will fix them and optimize your Drupal site 100% for Google and Bing. (Allow 30-60 seconds to gather data.)

Powered by

Learn how to reference URL relative to present web page in a block

On-Site Drupal SEO Master Setup

We make sure your site is 100% optimized (and stays that way) for the best SEO results.

With Pixeldust On-site (or On-page) SEO we make changes to your site’s structure and performance to make it easier for search engines to see and understand your site’s content. Search engines use algorithms to rank sites by degrees of relevance. Our on-site optimization ensures your site is configured to provide information in a way that meets Google and Bing standards for optimal indexing.

This service includes:

  • Pathauto install and configuration for SEO-friendly URLs.
  • Meta Tags install and configuration with dynamic tokens for meta titles and descriptions for all content types.
  • Install and fix all issues on the SEO checklist module.
  • Install and configure XML sitemap module and submit sitemaps.
  • Install and configure Google Analytics Module.
  • Install and configure Yoast.
  • Install and configure the Advanced Aggregation module to improve performance by minifying and merging CSS and JS.
  • Install and configure Schema.org Metatag.
  • Configure robots.txt.
  • Google Search Console setup snd configuration.
  • Find & Fix H1 tags.
  • Find and fix duplicate/missing meta descriptions.
  • Find and fix duplicate title tags.
  • Improve title, meta tags, and site descriptions.
  • Optimize images for better search engine optimization. Automate where possible.
  • Find and fix the missing alt and title tag for all images. Automate where possible.
  • The project takes 1 week to complete.